commit 5a5731e7c5a3f4ca83e71cfc82b08eb595a2c4bb Author: Jeremy Lecour Date: Wed Dec 21 15:39:50 2016 +0100 Initial commit with examples diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a8b42eb --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.retry diff --git a/README.md b/README.md new file mode 100644 index 0000000..2a7fd65 --- /dev/null +++ b/README.md @@ -0,0 +1,5 @@ +# Ansible-public + +``` +$ ansible-playbook playbooks/evolinux.yml -i inventory/hosts -K +``` diff --git a/inventory/group_vars/ansible-test.yml b/inventory/group_vars/ansible-test.yml new file mode 100644 index 0000000..ed97d53 --- /dev/null +++ b/inventory/group_vars/ansible-test.yml @@ -0,0 +1 @@ +--- diff --git a/inventory/host_vars/ansible-test1.yml b/inventory/host_vars/ansible-test1.yml new file mode 100644 index 0000000..7c5ace6 --- /dev/null +++ b/inventory/host_vars/ansible-test1.yml @@ -0,0 +1,4 @@ +--- +evolinux_hostname: ansible-test1 +evolinux_domain: evolix.net +evolinux_fqdn: ansible-test1.evolix.net diff --git a/inventory/host_vars/ansible-test2.yml b/inventory/host_vars/ansible-test2.yml new file mode 100644 index 0000000..02c6be1 --- /dev/null +++ b/inventory/host_vars/ansible-test2.yml @@ -0,0 +1,4 @@ +--- +evolinux_hostname: ansible-test2 +evolinux_domain: evolix.net +evolinux_fqdn: ansible-test2.evolix.net diff --git a/inventory/hosts b/inventory/hosts new file mode 100644 index 0000000..7c8c012 --- /dev/null +++ b/inventory/hosts @@ -0,0 +1,3 @@ +[ansible-test] +ansible-test1 ansible_user=evolix ansible_host=192.168.4.209 +ansible-test2 ansible_user=evolix ansible_host=192.168.4.211 diff --git a/playbooks/evolinux.yml b/playbooks/evolinux.yml new file mode 100644 index 0000000..f1049df --- /dev/null +++ b/playbooks/evolinux.yml @@ -0,0 +1,24 @@ +- hosts: ansible-test + gather_facts: yes + become: yes + vars_files: + - "../vars/global.yml" + + roles: + - "{{ roles }}/etc-git" + - "{{ roles }}/evolinux-base" + - "{{ roles }}/evolinux-admin-users" + - "{{ roles }}/munin" + - "{{ roles }}/minifirewall" + - "{{ roles }}/squid" + - "{{ roles }}/proftpd" + - "{{ roles }}/fail2ban" + - "{{ roles }}/listupgrade" + - "{{ roles }}/evomaintenance" + - "{{ roles }}/apt-repositories" + + post_tasks: + - include: "{{ tasks }}/commit_etc_git.yml" + - include: "{{ tasks }}/run_evocheck.yml" + +# vim:ft=ansible diff --git a/playbooks/httpd.yml b/playbooks/httpd.yml new file mode 100644 index 0000000..68e7225 --- /dev/null +++ b/playbooks/httpd.yml @@ -0,0 +1,15 @@ +- hosts: ansible-test + gather_facts: yes + become: yes + vars_files: + - "../vars/global.yml" + + vars: + - evolinux_default_www_nginx_enabled: True + + roles: + - "{{ roles }}/apache" + - "{{ roles }}/nginx" + - "{{ roles }}/evolinux-default-www" + +# vim:ft=ansible: diff --git a/tasks/commit_etc_git.yml b/tasks/commit_etc_git.yml new file mode 100644 index 0000000..93d8a4c --- /dev/null +++ b/tasks/commit_etc_git.yml @@ -0,0 +1,18 @@ +--- +- name: is /etc clean? + command: git status --porcelain + args: + chdir: /etc + changed_when: False + register: git_status + tags: + - git + +- name: /etc modifications are committed + shell: "git add -A . && git commit -m \"Ansible run\"" + args: + chdir: /etc + register: etc_commit_end_evolinux + when: git_status.stdout != "" + tags: + - git diff --git a/tasks/run_evocheck.yml b/tasks/run_evocheck.yml new file mode 100644 index 0000000..524f28f --- /dev/null +++ b/tasks/run_evocheck.yml @@ -0,0 +1,10 @@ +--- +- name: run evocheck + command: /usr/share/scripts/evocheck.sh + register: evocheck_run + changed_when: False + # failed_when: False + +- debug: + var: evocheck_run.stdout_lines + when: evocheck_run.rc != 0 diff --git a/vars/global.yml b/vars/global.yml new file mode 100644 index 0000000..be611ea --- /dev/null +++ b/vars/global.yml @@ -0,0 +1,3 @@ +--- +roles: ../../ansible-roles +tasks: ../tasks