From 61d91753490a9e4909f4054db6cb270a7de4f04c Mon Sep 17 00:00:00 2001 From: james mike dupont Date: Tue, 4 Oct 2016 06:07:52 -0400 Subject: [PATCH] first example --- Makefile | 5 +++++ ansible_hosts | 2 ++ tasks/main.yml | 22 ++++++++++++++++++---- test_playbook.yml | 13 +++++++++++++ zones/db.example.com | 0 zones/db.example2.com | 0 zones/db.example3.com | 1 + 7 files changed, 39 insertions(+), 4 deletions(-) create mode 100644 Makefile create mode 100644 ansible_hosts create mode 100644 test_playbook.yml create mode 100644 zones/db.example.com create mode 100644 zones/db.example2.com create mode 100644 zones/db.example3.com diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..2dce3fb --- /dev/null +++ b/Makefile @@ -0,0 +1,5 @@ +t: + strace -f -ostrace.txt -e open PYTHONPATH=/home/mdupont/experiments/ccore/ansible/lib python /home/mdupont/experiments/ccore/ansible/bin/ansible-playbook -i ansible_hosts test_playbook.yml --verbose + +t2: + PYTHONPATH=/home/mdupont/experiments/ccore/ansible/lib python /home/mdupont/experiments/ccore/ansible/bin/ansible-playbook -i ansible_hosts test_playbook.yml --verbose diff --git a/ansible_hosts b/ansible_hosts new file mode 100644 index 0000000..6b1fbfd --- /dev/null +++ b/ansible_hosts @@ -0,0 +1,2 @@ +[test] +local ansible_user=vagrant ansible_host=127.0.0.1 ansible_ssh_port=2200 bind_zone_master_server_ip=127.0.0.1 \ No newline at end of file diff --git a/tasks/main.yml b/tasks/main.yml index e45442f..c951158 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,8 @@ --- - name: install bind packages apt: pkg={{ item }} state={{ bind_pkg_state }} - with_items: bind_pkgs + with_items: + - "{{ bind_pkgs }}" - name: setup zone directories file: dest={{ bind_base_zones_path }}/{{ item }} state=directory owner={{ bind_user }} group={{ bind_group }} mode=0755 @@ -25,9 +26,22 @@ template: src=named.conf.options.j2 dest={{ bind_config_basepath }}/named.conf.options owner={{ bind_user }} group={{ bind_group }} mode=0600 notify: restart bind -- name: Copy master zone files - copy: src={{ bind_masterzones_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }}/{{bind_masterzones_path}} owner={{ bind_user }} group={{ bind_group }} - with_items: bind_config_master_zones +# - debug: var=bind_masterzones_path +# - debug: var=bind_base_zones_path +# - debug: var=bind_config_master_zones +# - debug: var=bind_user +# - debug: var=bind_group + +# - name: Copy master zone files +# #shell: echo src={{ bind_masterzones_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }} owner={{ bind_user }} group={{ bind_group }} +# shell: echo "src={{ bind_masterzones_path }}/db.{{ item.name }} dest={{ bind_base_zones_path }} owner={{ bind_user }} group={{ bind_group }}" +# with_items: +# - "{{bind_config_master_zones}}" + +- name: Copy master zone files2 + copy: src="{{ bind_masterzones_path }}/db.{{ item.name }}" dest="{{ bind_base_zones_path }}" owner="{{ bind_user }}" group="{{ bind_group }}" + with_items: + - "{{bind_config_master_zones}}" notify: reload bind tags: bind-zones diff --git a/test_playbook.yml b/test_playbook.yml new file mode 100644 index 0000000..8bf3af5 --- /dev/null +++ b/test_playbook.yml @@ -0,0 +1,13 @@ +--- +- hosts: all + remote_user: root + sudo: True + vars: + bind_masterzones_path: zones + bind_config_master_zones: + - name: example.com + - name: example2.com + - name: example3.com + + roles: + - { role: ../ansible-role-bind } diff --git a/zones/db.example.com b/zones/db.example.com new file mode 100644 index 0000000..e69de29 diff --git a/zones/db.example2.com b/zones/db.example2.com new file mode 100644 index 0000000..e69de29 diff --git a/zones/db.example3.com b/zones/db.example3.com new file mode 100644 index 0000000..40e5cb3 --- /dev/null +++ b/zones/db.example3.com @@ -0,0 +1 @@ +# bla