From 69167a79043b7b95e7bfe08161fabba3586f9bce Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Sun, 29 Aug 2021 03:35:49 +0000 Subject: [PATCH] added some ansible playbooks for experiments --- ansible-playbooks/README.txt | 5 +++++ ansible-playbooks/add-user-group.yml | 7 +++++++ ansible-playbooks/del-user-group.yml | 7 +++++++ ansible-playbooks/find-on-all.yml | 21 +++++++++++++++++++++ ansible-playbooks/get-m4.yml | 23 +++++++++++++++++++++++ ansible-playbooks/ls-on-all.yml | 17 +++++++++++++++++ ansible-playbooks/ping-on-all.yml | 6 ++++++ 7 files changed, 86 insertions(+) create mode 100644 ansible-playbooks/README.txt create mode 100644 ansible-playbooks/add-user-group.yml create mode 100644 ansible-playbooks/del-user-group.yml create mode 100644 ansible-playbooks/find-on-all.yml create mode 100644 ansible-playbooks/get-m4.yml create mode 100644 ansible-playbooks/ls-on-all.yml create mode 100644 ansible-playbooks/ping-on-all.yml diff --git a/ansible-playbooks/README.txt b/ansible-playbooks/README.txt new file mode 100644 index 0000000..61e992a --- /dev/null +++ b/ansible-playbooks/README.txt @@ -0,0 +1,5 @@ + + + +ansible-playbook add-user-group.yml --extra-vars "ansible_sudo_pass=" +ansible-playbook del-user-group.yml --extra-vars "ansible_sudo_pass=" diff --git a/ansible-playbooks/add-user-group.yml b/ansible-playbooks/add-user-group.yml new file mode 100644 index 0000000..d6cf14e --- /dev/null +++ b/ansible-playbooks/add-user-group.yml @@ -0,0 +1,7 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: add user group 'tomcat' + group: name=tomcat + become: true + become_method: sudo diff --git a/ansible-playbooks/del-user-group.yml b/ansible-playbooks/del-user-group.yml new file mode 100644 index 0000000..1182515 --- /dev/null +++ b/ansible-playbooks/del-user-group.yml @@ -0,0 +1,7 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: delete user group 'tomcat' + group: name=tomcat state=absent + become: true + become_method: sudo diff --git a/ansible-playbooks/find-on-all.yml b/ansible-playbooks/find-on-all.yml new file mode 100644 index 0000000..1650f5f --- /dev/null +++ b/ansible-playbooks/find-on-all.yml @@ -0,0 +1,21 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: test connection + find: + paths: /var/log + size: '1000000' + recurse: yes + register: out + + - name: print result + debug: + msg: "xxx: {{ item.path }}" + with_items: "{{ out.files }}" + + +## - debug: var=item.path +## with_items: "{{ out.files }}" + +## - debug: var=out.files + diff --git a/ansible-playbooks/get-m4.yml b/ansible-playbooks/get-m4.yml new file mode 100644 index 0000000..706f192 --- /dev/null +++ b/ansible-playbooks/get-m4.yml @@ -0,0 +1,23 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: Download GNU m4-1.14-19 + get_url: + url=https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz + dest=/tmp/m4-1.14-19.tar.gz force=no + + - name: Untar m4 + unarchive: + src: /tmp/m4-1.14-19.tar.gz + dest: /tmp/ + remote_src: yes + + - name: Delete the m4 file downloaded + file: + path=/tmp/m4-1.14-19.tar.gz + state=absent + + - name: Delete the m4 directory + file: + path=/tmp/m4-1.4.19/ + state=absent diff --git a/ansible-playbooks/ls-on-all.yml b/ansible-playbooks/ls-on-all.yml new file mode 100644 index 0000000..f2b0a26 --- /dev/null +++ b/ansible-playbooks/ls-on-all.yml @@ -0,0 +1,17 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: run ls + shell: ls -laF /etc + register: out + +# - name: print result +# debug: +# msg: "xxx: {{ out.stdout }}" + + + - name: print result + debug: + msg: "xxx: {{ item }}" + loop: "{{ out.stdout_lines }}" + diff --git a/ansible-playbooks/ping-on-all.yml b/ansible-playbooks/ping-on-all.yml new file mode 100644 index 0000000..22096a9 --- /dev/null +++ b/ansible-playbooks/ping-on-all.yml @@ -0,0 +1,6 @@ +- hosts: all + remote_user: hyung-hwan + tasks: + - name: test connection + ping: +