From 940b2720daa0b7e3d2b66339652680388f9bcc76 Mon Sep 17 00:00:00 2001 From: Alan Orth Date: Thu, 10 Dec 2015 00:25:44 +0200 Subject: [PATCH] Rename nginx_* variables underneath nginx_vhosts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It's just deduplication, since it's already obvious that the dict is for nginx-related vars: - nginx_domain_name→domain_name - nginx_domain_aliases→domain_aliases - nginx_enable_https→enable_https - nginx_enable_hsts→enable_hsts Signed-off-by: Alan Orth --- host_vars/web06 | 156 +++++++++++++------------- roles/nginx/tasks/vhosts.yml | 8 +- roles/nginx/templates/https.j2 | 4 +- roles/nginx/templates/vhost.conf.j2 | 8 +- roles/php5-fpm/tasks/main.yml | 2 +- roles/php5-fpm/templates/pool.conf.j2 | 2 +- 6 files changed, 89 insertions(+), 91 deletions(-) diff --git a/host_vars/web06 b/host_vars/web06 index b7fed71..b4df202 100644 --- a/host_vars/web06 +++ b/host_vars/web06 @@ -1,80 +1,78 @@ $ANSIBLE_VAULT;1.1;AES256 -30663034313534353238656630633931333934623264636663613431333964653564396461343966 -6561343630653135313130333733343131386364366439390a333961306238633536306335656539 -62386564666363346361353930316336323536373964303866336361393065326539396464363237 -3863613337623836650a343835383035613165393734653763666130616565626135363031643164 -35333433646564383635643832356365646633303533386335323330383836316235366563323334 -31376631623530656563386137613839323262396664646465333234393864366464646339303464 -32643437373632306437353130343330616336303034626466613232613432313739373933633737 -64336332346436353262666365626263636230333935643966353535653534373339623261636131 -36646465393632623731663136346439333931373835313262663430313735396335353631373737 -31353038303534353837383334383163616131666434663231356163633463363764353836396361 -61616635353863346330303264373534363865643132343133643231333332373231326534653432 -32356137313938383437666430336662633837373431373336333831313562393762313731343032 -64366437363434396164653839363937306532323936346565333131363761303262633265613730 -64376263323730623065663032353662303339313831366335373438323537326161376436373632 -36613664636638363434353731366338383063653731353065623066666237373662346535666262 -36333862636231353565663866656134326133343162306263343030333739346636316539636561 -38313238383333373361373637623965333566343664636534373632313965306635613035356332 -35386430303061353961663734616434636235376666386632343732613662636438386635353435 -36343136666463663363656233656538363166343562623366616364383366643465353234313039 -30363264633937383637326433386265373061326539353561623736353431623063303339666133 -34393662343637613266323430653938636462633739613637623338393561633165626638653433 -34363564616537353031353632386637656363356138653361383764346461336164396361363638 -37356665353864333163376565323034613830613734333134393432663561346338393838343632 -34373835653361313434306564656463616362656134343361386139353438623430646664656532 -36366334353235366232623266633935376132316432303436393133376365383335643238623061 -38303361613133363537366665323166303463353031396135323462336536333531666638373565 -34353634376365316234623239323735396539626162316533333935653062363238363461333438 -33393361623133623436623761366465376433663830616231356237633366323837376162363665 -39306635363634343161306535663131386332366630666637376539303965366630343765633361 -39366135326532653261313930366465336538613362303264356162363035333438616462366130 -62623433626461623933353830303863363339613634313564333139636634336466363032343362 -39663862326236393337396332646330613734366431303665643930623335363961336131386161 -63663335653335373031326266333033373365666335643461356263633130643237346465373735 -36636232373235653763643239623662303535666336396133386231303439353562346164623730 -37343635383831653165633631643063613638666166616231616536353934613633336662343266 -35656465393938343830623335643930653637306266366436646366356630646264346264313631 -37636539663261303731323862666466316231306232366661636238356235643165643932643432 -38313134313137353038363064313239386435356536663638393830386533346664313838373936 -65343666303362346333366135626534386331353161363930656666646164343932656366343430 -30356436653534616135353034313163613566633264633763353731333439373434386563363232 -38303131613139373035396435313563393165326366343930346262393932323363313538636437 -61323936366637303961336365393435656439666261316634653330653838633333333539393262 -37636136633836313630656235303663333462356530613930343532386236323631306439313461 -36363164656332613733663730303830663366323266386361363561316136663338396638656561 -61656535636630643637663961626664356633613966373038626537643734313332666139666232 -36613563386433653233396434646530303033643134633061663139656262656532623362356138 -65376365363732396130363262373638366462326331333465656333306136366235336264323964 -35363731666233303031343565333234323038326365343465616231363733376339363237323137 -32333564376434323739373765653133636161616639323930363734636632636535643461323336 -61313863653333383133373039633665353236616635373363636135356338653233346662643139 -65613835623963626634363234653234386361343037653761663862363166663430626439653766 -37306536306165656363333464666361316535313166383233303266316165343238303130303432 -61616265353466633630343231303331323635343761616436633736366630613361336238383464 -37356163656135666339653465343337623765356163333964393930323939646639373162393062 -35326661643963326237303930303437613030333732323863383836326365393136613530386362 -33636239313636623837643564663431323933313732613230363764626631383135626636623732 -33303731656534333362653961623938353038373030343433376636666135653964633933306530 -61333233653332396465643330396461303162303161343632373638366363386638383835633734 -64366432323838363837666231353061323261663535356131623430626633343135316437616431 -37636435626465343366343162373839633935663964363538396231393634353034643566663238 -33323336316532323035666164653737336234303764636237323766663733383833393265383538 -35333635636264333334613037666462653262343132643266616463356339393464386531373962 -64393565353735626337633163376265646537646661643131363434373663343363336664376535 -64366230343766656461376563366165646131613466393762393334633739616664666538663735 -30366131326238353761346130656666653936316634366664653730306264353835656333643332 -64316562383934393761666663623335353465663438383061663937656239666134303663353337 -30313938663662666466643365636138356333616630646139363139356639356132343531306332 -65636230393662636632626432373863356632346530353764393163356333623637373238643831 -33373739643430363632313833383931326662663639346533376336383139316463616563343232 -39383632356230363236626437376364613639376162613836393233663265663565666463343263 -32376232633636376663346437326635343461343630666263636264313465356437616432616363 -62633338366661326366313362323462333061623033626265656133366261363565346133323133 -66356363656463643966633566326238393464653535313964306166623639653266313430633137 -35353862356535623561643635363937386335313834663138336134643961363434336439663964 -34626461383531333533346632653237613632316565663938616531383831316361303331333863 -64396264363266303861373832313164326163656366666334316537333339306536353965356437 -61313636633332376366636364383562333737383439353561333961363532646464653233373537 -37653239623362313563633737626437643931393338633230333634323939613933343930333939 -393630323735333832633865353562326466 +36313063373337656139333763643531663862343434376637333864653430646262346163623333 +3438646233623466386439626331323361653930626531650a336232323836656664313338616131 +36373232323466663730626136313265653331376134336139373861633530333837353366353361 +3134663734316537630a393432353762653862663538613966633365393263333034616262313637 +65626637333866653163313364316431343566656537346338623030363139663730313136663234 +30313461646338303561363461376239303262396135353137646237373662383662316366333065 +61623132356530363632393965613361373466313338656339646161343963306531393838636339 +32666362323534613263366266356331333038376133616634376234623038656436633937613264 +37363630353939373235653865306136623131633562306632623232366432383233393832613263 +31366339316562383232646534393232653163316132373162326337366536623161333764326638 +62343636633332323435363066393961333430386238393361396463626661336363363434303738 +62646663373661323331633639316136636632616662376262666465313737656639343936643937 +30626136323865623263383830623632666131623637623262326566383764313530613362383330 +63626561306432316536393330333135663734646265623634356232643764353135383134386135 +32303630393564333861323135343462656362333862623334666266323066313535346633323439 +37396637323533666464386333376165393737653132633735663434646334326666323061653164 +36646262383039323562356435636239336234613331633536363166333366386364333132653232 +34333335616465356633656465303733653164633430373134656631653038386530613538623836 +64363966303032333033396133356265333832373863646338616335366530633133333264343461 +65653131393266613237346662373963393963643530623830393132343735333665313438643738 +61363230353139623938633762303432666339326630306666313135346230613065613037366139 +61623633616536663163646134386631643734613135303431643335653832633731626262646264 +35303065383936626239336165373134326530373330663634343031393564323837393065386165 +31353133393932626630306366373533656431316337353834383463343365333638316335366364 +35646237376466316331623231613136383733353333656533303064353033333935316235663837 +32656263636364383532656135663065393736306262306465333565636137306363313731666234 +65366632373831306538333537373533326132613134316364306530373661626138363434643965 +61333035383131656233343864343134303638656138356365636663326164393532646261633566 +39653537663837343535323362376464356337343737313663393930306537653062303036663237 +31336331633134656236616633363532373832323138633731346438653238363536636632353230 +38356339303661616231326431323235663062613962613334616438613263383532653030636563 +35343437623736646165646262653630396130633038363761373861346530313732326661613162 +36633331383338623930633065316432653734396230376565346433343563383939343333633466 +34306133623235636437643135353831616338393364353336333934343237633764343035336130 +61376661373633373233663366313761616131333837303931633136373931396163663538666431 +33373333643164393866663135313562646262376331323536383334306530363739386139336636 +30633832656139306561366661393736633731623064316165346561366536376135656638653034 +30363836613463323031363633343861316564626662363130383037383464306631353534623433 +63353461313166363864393431633330616138343063343561326637363463343032666466643334 +38366536626637383866383936363339646263333535663430663566323939656261646430623632 +64653930363965343136653032626436626361613838343131663964656361346430383035376164 +63383531336432323961633633303139313333363965353135356532383330303830343266353539 +36653866353532616234653831663962616234663432633430313137656361616338383235303134 +62333830636636636233633835656632313836316232623165393539666462313539616234636561 +31373564613464363762373932636532666534336439623436373437306232313739383330633933 +33616463666566326534656430623833613533373538326534366339313736373463346365376633 +39366530663538333038666534326265653563646239363661623231613164646131616638666564 +36653532346131323536623938313432633539343636333433306265653061346337663762653835 +62356564656330316333646636613031633836316162663766613863386535623666363336643533 +32373030326263663237303735323335633533663831373938323232336633326335333638313836 +64633763363739663138626436323536373430376163623636356161393863613231353065333262 +63386339663930393666663437303634353761643035613765323232366163643036653038623333 +36393833333438326661306633343330326332623933346331616634383861393734623736353163 +62666630363935356238306565336565316435323033343434343635633064666235323562633835 +34313330376435363731316138623064313933326364333138366531383430623135393739386163 +63613736383961643536396661356632623638393633646436366337613937633061303531386535 +65623762356139313935323363633634663139366638343665623939656231323861303061326235 +36353239646362323765313033366535313266343562333330623735363633386633666430663630 +34633838643163623939316163663837363530383733613138336330303663383935326437636436 +34613831396631366462366136616264313938623832636231373834363736313066343436326631 +61303130313132353836373935313662313531353833316364623663316134633535393734333831 +65643031376561306163316663366231326466333262643936313238383234363566383865623166 +66613830343966313938326462366635656132336635633361303336663664303032623462646665 +31653031386639303239383365633439613961643762633662303961353534313366306139343133 +31366462383564383061306261393061383461363933646534623631656635613166386137663538 +32336439393437383437386537323138373733666562323434373964343566353962623537386465 +35343931323763363232343266346462346331303663356530666363613361643030336335656564 +35613963643031316630663231336432653834386163313565626339336333633138396130303933 +36336263316233336638303931393961366632306536626233623266616132313137356438666565 +64383836383832613830653264636161396162303736646630383939306465333366633738326533 +30396163346130373132663332383862366137666638353936326533346339353630363432333264 +64343166356634333765326131633836313461616339653861376531353332613731313736323630 +64333863333437323561623665333731633038376231316464346263356465306365313537633639 +39636236336262393738653962343463636631323761626666616161386636313930396537353238 +30643835323161613766383432353236636639613738383538636432333961336561626665383965 +31316666326538633864343864653632383437613166666334356335316131313964393136326363 +6232 diff --git a/roles/nginx/tasks/vhosts.yml b/roles/nginx/tasks/vhosts.yml index e8136a6..75a725e 100644 --- a/roles/nginx/tasks/vhosts.yml +++ b/roles/nginx/tasks/vhosts.yml @@ -1,7 +1,7 @@ --- - name: Configure https vhosts - template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.nginx_domain_name }}.conf mode=0644 owner=root group=root + template: src=vhost.conf.j2 dest={{ nginx_confd_path }}/{{ item.domain_name }}.conf mode=0644 owner=root group=root with_items: nginx_vhosts notify: - reload nginx @@ -17,17 +17,17 @@ - reload nginx - name: Create vhost document roots - file: path={{ nginx_root_prefix }}/{{ item.nginx_domain_name }} state=directory mode=0755 owner=nginx group=nginx + file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory mode=0755 owner=nginx group=nginx with_items: nginx_vhosts - name: Install WordPress - git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.nginx_domain_name }}/wordpress version={{ item.wordpress_version }} depth=1 + git: repo=https://github.com/WordPress/WordPress.git dest={{ nginx_root_prefix }}/{{ item.domain_name }}/wordpress version={{ item.wordpress_version }} depth=1 when: item.has_wordpress == 'yes' with_items: nginx_vhosts tags: wordpress - name: Fix WordPress directory permissions - file: path={{ nginx_root_prefix }}/{{ item.nginx_domain_name }} state=directory owner=nginx group=nginx recurse=yes + file: path={{ nginx_root_prefix }}/{{ item.domain_name }} state=directory owner=nginx group=nginx recurse=yes when: item.has_wordpress == 'yes' with_items: nginx_vhosts tags: wordpress diff --git a/roles/nginx/templates/https.j2 b/roles/nginx/templates/https.j2 index 29ac0f2..749c298 100644 --- a/roles/nginx/templates/https.j2 +++ b/roles/nginx/templates/https.j2 @@ -1,7 +1,7 @@ {# helper variables and per-site defaults that we can't set in role defaults #} -{% set domain_name = item.nginx_domain_name %} +{% set domain_name = item.domain_name %} {# assume HSTS is off unless a vhost explicitly sets it to "yes" #} -{% set enable_hsts = item.nginx_enable_hsts | default("no") %} +{% set enable_hsts = item.enable_hsts | default("no") %} {# use self-signed certs? yes on development, no on production #} {% set use_snakeoil_cert = item.use_snakeoil_cert | default("no") %} diff --git a/roles/nginx/templates/vhost.conf.j2 b/roles/nginx/templates/vhost.conf.j2 index 8268ddc..0e94b00 100644 --- a/roles/nginx/templates/vhost.conf.j2 +++ b/roles/nginx/templates/vhost.conf.j2 @@ -1,9 +1,9 @@ {# helper variables and per-site defaults that we can't set in role defaults #} -{% set domain_name = item.nginx_domain_name %} -{% set domain_aliases = item.nginx_domain_aliases | default("") %} -{% set enable_https = item.nginx_enable_https | default("no") %} +{% set domain_name = item.domain_name %} +{% set domain_aliases = item.domain_aliases | default("") %} +{% set enable_https = item.enable_https | default("no") %} {# assume HSTS is off unless a vhost explicitly sets it to "yes" #} -{% set enable_hsts = item.nginx_enable_hsts | default("no") %} +{% set enable_hsts = item.enable_hsts | default("no") %} {% set has_wordpress = item.has_wordpress | default("no") %} {% if enable_https == "yes" %} diff --git a/roles/php5-fpm/tasks/main.yml b/roles/php5-fpm/tasks/main.yml index ff3bf98..6faaa8b 100644 --- a/roles/php5-fpm/tasks/main.yml +++ b/roles/php5-fpm/tasks/main.yml @@ -10,7 +10,7 @@ tags: php5-fpm - name: Copy php5-fpm pool config - template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.nginx_domain_name }}.conf owner=root group=root mode=0644 + template: src=pool.conf.j2 dest=/etc/php5/fpm/pool.d/{{ item.domain_name }}.conf owner=root group=root mode=0644 with_items: nginx_vhosts when: nginx_vhosts is defined notify: restart php5-fpm diff --git a/roles/php5-fpm/templates/pool.conf.j2 b/roles/php5-fpm/templates/pool.conf.j2 index b3fb5e8..a3e4144 100644 --- a/roles/php5-fpm/templates/pool.conf.j2 +++ b/roles/php5-fpm/templates/pool.conf.j2 @@ -1,4 +1,4 @@ -{% set domain_name = item.nginx_domain_name %} +{% set domain_name = item.domain_name %} ; Start a new pool named '{{ domain_name }}'. ; the variable $pool can we used in any directive and will be replaced by the