From 4d8f26f1a9cb2a009e92f9244b20a74103666e54 Mon Sep 17 00:00:00 2001 From: Caleb Fultz Date: Fri, 12 Jul 2024 15:35:38 -0400 Subject: [PATCH] first playbooks --- first-playbook/ansible.cfg | 5 +++++ first-playbook/install_apache.yml | 18 ++++++++++++++++++ first-playbook/inventory | 2 ++ first-playbook/remove_apache.yml | 18 ++++++++++++++++++ 4 files changed, 43 insertions(+) create mode 100644 first-playbook/ansible.cfg create mode 100644 first-playbook/install_apache.yml create mode 100644 first-playbook/inventory create mode 100644 first-playbook/remove_apache.yml diff --git a/first-playbook/ansible.cfg b/first-playbook/ansible.cfg new file mode 100644 index 0000000..0056832 --- /dev/null +++ b/first-playbook/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +inventory = inventory +private_key_file = ~/.ssh/hetzner + + diff --git a/first-playbook/install_apache.yml b/first-playbook/install_apache.yml new file mode 100644 index 0000000..e40ae9f --- /dev/null +++ b/first-playbook/install_apache.yml @@ -0,0 +1,18 @@ +--- +- hosts: all + become: true + tasks: + + - name: Update repository index + ansible.builtin.apt: + update_cache: yes + + - name: Install apache2 package + ansible.builtin.apt: + name: apache2 + state: latest + + - name: Install support for php + ansible.builtin.apt: + name: libapache2-mod-php + state: latest diff --git a/first-playbook/inventory b/first-playbook/inventory new file mode 100644 index 0000000..8b15755 --- /dev/null +++ b/first-playbook/inventory @@ -0,0 +1,2 @@ +10.0.0.7 +10.0.0.8 diff --git a/first-playbook/remove_apache.yml b/first-playbook/remove_apache.yml new file mode 100644 index 0000000..3d71d46 --- /dev/null +++ b/first-playbook/remove_apache.yml @@ -0,0 +1,18 @@ +--- +- hosts: all + become: true + tasks: + + - name: Update repository index + ansible.builtin.apt: + update_cache: yes + + - name: Install apache2 package + ansible.builtin.apt: + name: apache2 + state: absent + + - name: Install support for php + ansible.builtin.apt: + name: libapache2-mod-php + state: absent