aboutsummaryrefslogtreecommitdiff
path: root/ansible
diff options
context:
space:
mode:
authorMilo Casagrande <milo@ubuntu.com>2014-06-13 09:21:21 +0200
committerMilo Casagrande <milo@ubuntu.com>2014-06-13 09:21:21 +0200
commitf5fe84dc471b74e0a6c6c03e59bad004e941057c (patch)
treeeedc7b3cd9341ccce8834acbb7a59284bb010820 /ansible
parent5d98b0621fc38061d1a3152366a160fbe15e7a73 (diff)
parent06faa59779b2c942196ac0ba831b101088e69b0f (diff)
Merge branch 'master' of git://git.linaro.org/people/milo.casagrande/linaro-ansible-common
Diffstat (limited to 'ansible')
-rw-r--r--ansible/roles/common/README5
-rw-r--r--ansible/roles/common/handlers/apache.yml12
-rw-r--r--ansible/roles/common/handlers/main.yml7
-rw-r--r--ansible/roles/common/handlers/nginx.yml12
-rw-r--r--ansible/roles/common/handlers/reload-apache.yml3
-rw-r--r--ansible/roles/common/handlers/restart-apache.yml3
-rw-r--r--ansible/roles/common/handlers/started-apache.yml3
-rw-r--r--ansible/roles/common/handlers/stop-apache.yml3
-rw-r--r--ansible/roles/common/handlers/uwsgi.yml12
-rw-r--r--ansible/roles/common/tasks/host-nickname.yml15
-rw-r--r--ansible/roles/common/tasks/net-sysctl.yml3
-rw-r--r--ansible/roles/common/templates/base-bashrc1
-rw-r--r--ansible/roles/common/templates/host-nickname.sh2
13 files changed, 56 insertions, 25 deletions
diff --git a/ansible/roles/common/README b/ansible/roles/common/README
index 07a0b26..1fb93c9 100644
--- a/ansible/roles/common/README
+++ b/ansible/roles/common/README
@@ -15,6 +15,11 @@ To include it:
Then commit normally.
+To pull in new changes:
+
+ git fetch ansible_common
+ git pull -s subtree ansible_common master
+
Alternatively, you can use it as an external source for a role. In this case
you need to tell Ansible where to look for roles. Please refer to Ansible
documentation.
diff --git a/ansible/roles/common/handlers/apache.yml b/ansible/roles/common/handlers/apache.yml
new file mode 100644
index 0000000..a4b55e3
--- /dev/null
+++ b/ansible/roles/common/handlers/apache.yml
@@ -0,0 +1,12 @@
+---
+- name: reload-apache
+ service: name=apache2 state=reloaded
+
+- name: restart-apache
+ service: name=apache2 state=restarted
+
+- name: started-apache
+ service: name=apache2 state=started
+
+- name: stop-apache
+ service: name=apache2 state=stopped
diff --git a/ansible/roles/common/handlers/main.yml b/ansible/roles/common/handlers/main.yml
index 9862b0a..3021bd9 100644
--- a/ansible/roles/common/handlers/main.yml
+++ b/ansible/roles/common/handlers/main.yml
@@ -1,5 +1,4 @@
---
-- include: reload-apache.yml
-- include: stop-apache.yml
-- include: started-apache.yml
-- include: restart-apache.yml
+- include: apache.yml
+- include: nginx.yml
+- include: uwsgi.yml
diff --git a/ansible/roles/common/handlers/nginx.yml b/ansible/roles/common/handlers/nginx.yml
new file mode 100644
index 0000000..0f8d59b
--- /dev/null
+++ b/ansible/roles/common/handlers/nginx.yml
@@ -0,0 +1,12 @@
+---
+- name: reload-nginx
+ service: name=nginx state=reloaded
+
+- name: restart-nginx
+ service: name=nginx state=restarted
+
+- name: started-nginx
+ service: name=nginx state=started
+
+- name: stop-nginx
+ service: name=nginx state=stopped
diff --git a/ansible/roles/common/handlers/reload-apache.yml b/ansible/roles/common/handlers/reload-apache.yml
deleted file mode 100644
index 630dcb2..0000000
--- a/ansible/roles/common/handlers/reload-apache.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: reload-apache
- service: name=apache2 state=reloaded
diff --git a/ansible/roles/common/handlers/restart-apache.yml b/ansible/roles/common/handlers/restart-apache.yml
deleted file mode 100644
index 34acdc4..0000000
--- a/ansible/roles/common/handlers/restart-apache.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: restart-apache
- service: name=apache2 state=restarted
diff --git a/ansible/roles/common/handlers/started-apache.yml b/ansible/roles/common/handlers/started-apache.yml
deleted file mode 100644
index f45ee21..0000000
--- a/ansible/roles/common/handlers/started-apache.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: started-apache
- service: name=apache2 state=started
diff --git a/ansible/roles/common/handlers/stop-apache.yml b/ansible/roles/common/handlers/stop-apache.yml
deleted file mode 100644
index 6bf18e8..0000000
--- a/ansible/roles/common/handlers/stop-apache.yml
+++ /dev/null
@@ -1,3 +0,0 @@
----
-- name: stop-apache
- service: name=apache2 state=stopped
diff --git a/ansible/roles/common/handlers/uwsgi.yml b/ansible/roles/common/handlers/uwsgi.yml
new file mode 100644
index 0000000..a52e9ae
--- /dev/null
+++ b/ansible/roles/common/handlers/uwsgi.yml
@@ -0,0 +1,12 @@
+---
+- name: reload-uwsgi
+ service: name=uwsgi state=reloaded
+
+- name: restart-uwsgi
+ service: name=uwsgi state=restarted
+
+- name: started-uwsgi
+ service: name=uwsgi state=started
+
+- name: stop-uwsgi
+ service: name=uwsgi state=stopped
diff --git a/ansible/roles/common/tasks/host-nickname.yml b/ansible/roles/common/tasks/host-nickname.yml
index ec8fe4b..ad380ae 100644
--- a/ansible/roles/common/tasks/host-nickname.yml
+++ b/ansible/roles/common/tasks/host-nickname.yml
@@ -7,20 +7,25 @@
# This will only work for new users, already existing users will have to tweak
# their bashrc file accordingly.
#
-# This role requires the variable 'hostname' to be set.
-#
+# This role requires the variable 'nickname' to be set.
+
+- name: Test if we can install nickname file
+ shell: test -f /etc/profile.d/host-nickname.sh
+ register: host_nickname
+ ignore_errors: True
-- name: host-nickname-var-file
+- name: Install host nickname shell definition
template: src=host-nickname.sh
dest=/etc/profile.d/host-nickname.sh
owner=root
group=root
mode=0444
+ when: host_nickname.rc|int == 1
-# Install a default bashrc for new users.
-- name: host-nickname-bashrc-addition
+- name: Install a default bashrc for new users
template: src=base-bashrc
dest=/etc/skel/.bashrc
owner=root
group=root
mode=0644
+ when: host_nickname.rc|int == 1
diff --git a/ansible/roles/common/tasks/net-sysctl.yml b/ansible/roles/common/tasks/net-sysctl.yml
index eb84890..30b9262 100644
--- a/ansible/roles/common/tasks/net-sysctl.yml
+++ b/ansible/roles/common/tasks/net-sysctl.yml
@@ -1,6 +1,5 @@
---
-# Make sure some default and optimized values are used.
-- name: net-sysctl-conf
+- name: Tweak kernel network configuration for performance
copy: src=sysctl.conf
dest=/etc/sysctl.conf
owner=root
diff --git a/ansible/roles/common/templates/base-bashrc b/ansible/roles/common/templates/base-bashrc
index a1a97ae..de88aa8 100644
--- a/ansible/roles/common/templates/base-bashrc
+++ b/ansible/roles/common/templates/base-bashrc
@@ -110,4 +110,3 @@ fi
if [ "$NICKNAME" ]; then
PS1=$(echo "$PS1" | sed 's.\\h.$NICKNAME.g')
fi
-
diff --git a/ansible/roles/common/templates/host-nickname.sh b/ansible/roles/common/templates/host-nickname.sh
index fb2bd5d..bf6177e 100644
--- a/ansible/roles/common/templates/host-nickname.sh
+++ b/ansible/roles/common/templates/host-nickname.sh
@@ -1,2 +1,2 @@
# Managed via ansible.
-export NICKNAME={{ hostname }}
+export NICKNAME={{ nickname }}