From 30a9693c4e582eaa2dab9e5e946f68e3d0adbbf3 Mon Sep 17 00:00:00 2001 From: Tim Gerla Date: Mon, 6 May 2013 20:03:39 -0700 Subject: [PATCH] Updates for style and 1.2 syntax --- lamp_haproxy/roles/base-apache/tasks/main.yml | 2 +- lamp_haproxy/roles/common/tasks/main.yml | 2 +- lamp_haproxy/roles/db/tasks/main.yml | 6 ++--- lamp_haproxy/roles/haproxy/tasks/main.yml | 2 +- lamp_haproxy/roles/nagios/tasks/main.yml | 4 ++-- lamp_haproxy/roles/web/tasks/main.yml | 4 ++-- lamp_haproxy/rolling_update.yml | 24 +++++++++---------- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lamp_haproxy/roles/base-apache/tasks/main.yml b/lamp_haproxy/roles/base-apache/tasks/main.yml index 4b5a2d6..84ba6bb 100644 --- a/lamp_haproxy/roles/base-apache/tasks/main.yml +++ b/lamp_haproxy/roles/base-apache/tasks/main.yml @@ -2,7 +2,7 @@ # This role installs httpd - name: Install http and php etc - yum: name=$item state=installed + yum: name={{ item }} state=present with_items: - httpd - libsemanage-python diff --git a/lamp_haproxy/roles/common/tasks/main.yml b/lamp_haproxy/roles/common/tasks/main.yml index 841fc0c..e850ac8 100644 --- a/lamp_haproxy/roles/common/tasks/main.yml +++ b/lamp_haproxy/roles/common/tasks/main.yml @@ -8,7 +8,7 @@ copy: src=RPM-GPG-KEY-EPEL-6 dest=/etc/pki/rpm-gpg - name: install some useful nagios plugins - yum: name=$item state=present + yum: name={{ item }} state=present with_items: - nagios-nrpe - nagios-plugins-swap diff --git a/lamp_haproxy/roles/db/tasks/main.yml b/lamp_haproxy/roles/db/tasks/main.yml index 37772a4..d54f04c 100644 --- a/lamp_haproxy/roles/db/tasks/main.yml +++ b/lamp_haproxy/roles/db/tasks/main.yml @@ -2,7 +2,7 @@ # This role will install MySQL and create db user and give permissions. - name: Install Mysql package - yum: pkg=$item state=installed + yum: name={{ item }} state=present with_items: - mysql-server - MySQL-python @@ -21,7 +21,7 @@ service: name=mysqld state=started enabled=true - name: Create Application Database - mysql_db: name=$dbname state=present + mysql_db: name={{ dbname }} state=present - name: Create Application DB User - mysql_user: name=$dbuser password=$upassword priv=*.*:ALL host='%' state=present + mysql_user: name={{ dbuser }} password={{ upassword }} priv=*.*:ALL host='%' state=present diff --git a/lamp_haproxy/roles/haproxy/tasks/main.yml b/lamp_haproxy/roles/haproxy/tasks/main.yml index 9f3cf2b..ef025f6 100644 --- a/lamp_haproxy/roles/haproxy/tasks/main.yml +++ b/lamp_haproxy/roles/haproxy/tasks/main.yml @@ -2,7 +2,7 @@ # This role installs HAProxy and configures it. - name: Download and install haproxy and socat - yum: name=$item state=installed + yum: name={{ item }} state=present with_items: - haproxy - socat diff --git a/lamp_haproxy/roles/nagios/tasks/main.yml b/lamp_haproxy/roles/nagios/tasks/main.yml index 5216708..19a12a9 100644 --- a/lamp_haproxy/roles/nagios/tasks/main.yml +++ b/lamp_haproxy/roles/nagios/tasks/main.yml @@ -2,7 +2,7 @@ # This will install nagios - name: install nagios - yum: pkg=$item state=installed + yum: pkg={{ item }} state=present with_items: - nagios - nagios-plugins @@ -30,7 +30,7 @@ - name: create the nagios object files template: src={{ item + ".j2" }} - dest=/etc/nagios/ansible-managed/{{ item }} + dest=/etc/nagios/ansible-managed/ with_items: - webservers.cfg - dbservers.cfg diff --git a/lamp_haproxy/roles/web/tasks/main.yml b/lamp_haproxy/roles/web/tasks/main.yml index 06409c9..b11f9f4 100644 --- a/lamp_haproxy/roles/web/tasks/main.yml +++ b/lamp_haproxy/roles/web/tasks/main.yml @@ -2,7 +2,7 @@ # httpd is handled by the base-apache role upstream - name: Install php and git - yum: name=$item state=installed + yum: name={{ item }} state=present with_items: - php - php-mysql @@ -12,4 +12,4 @@ seboolean: name=httpd_can_network_connect_db state=true persistent=yes - name: Copy the code from repository - git: repo=${repository} version=${webapp_version} dest=/var/www/html/ + git: repo={{ repository }} version={{ webapp_version }} dest=/var/www/html/ diff --git a/lamp_haproxy/rolling_update.yml b/lamp_haproxy/rolling_update.yml index fdb7e25..e0427c6 100644 --- a/lamp_haproxy/rolling_update.yml +++ b/lamp_haproxy/rolling_update.yml @@ -18,14 +18,14 @@ # These are the tasks to run before applying updates: pre_tasks: - name: disable nagios alerts for this host webserver service - nagios: action=disable_alerts host=$ansible_hostname services=webserver - delegate_to: $item - with_items: ${groups.monitoring} + nagios: action=disable_alerts host={{ ansible_hostname }} services=webserver + delegate_to: "{{ item }}" + with_items: groups.monitoring - name: disable the server in haproxy - shell: echo "disable server myapplb/${ansible_hostname}" | socat stdio /var/lib/haproxy/stats - delegate_to: $item - with_items: ${groups.lbservers} + shell: echo "disable server myapplb/{{ ansible_hostname }}" | socat stdio /var/lib/haproxy/stats + delegate_to: "{{ item }}" + with_items: groups.lbservers roles: - common @@ -35,11 +35,11 @@ # These tasks run after the roles: post_tasks: - name: Enable the server in haproxy - shell: echo "enable server myapplb/${ansible_hostname}" | socat stdio /var/lib/haproxy/stats - delegate_to: $item - with_items: ${groups.lbservers} + shell: echo "enable server myapplb/{{ ansible_hostname }}" | socat stdio /var/lib/haproxy/stats + delegate_to: "{{ item }}" + with_items: groups.lbservers - name: re-enable nagios alerts - nagios: action=enable_alerts host=$ansible_hostname services=webserver - delegate_to: $item - with_items: ${groups.monitoring} + nagios: action=enable_alerts host={{ ansible_hostname }} services=webserver + delegate_to: "{{ item }}" + with_items: groups.monitoring