diff --git a/06-copying-files/ansible.cfg b/06-copying-files/ansible.cfg new file mode 100644 index 0000000..0056832 --- /dev/null +++ b/06-copying-files/ansible.cfg @@ -0,0 +1,5 @@ +[defaults] +inventory = inventory +private_key_file = ~/.ssh/hetzner + + diff --git a/06-copying-files/files/default_site.html b/06-copying-files/files/default_site.html new file mode 100644 index 0000000..b14f198 --- /dev/null +++ b/06-copying-files/files/default_site.html @@ -0,0 +1,11 @@ + + + + Website test + + + +

Goodevening Caleb

+ + + diff --git a/06-copying-files/install_apache.yml b/06-copying-files/install_apache.yml new file mode 100644 index 0000000..3f7996d --- /dev/null +++ b/06-copying-files/install_apache.yml @@ -0,0 +1,15 @@ +--- +- hosts: all + become: true + tasks: + +#### Ubuntu/Debian Section #### + + - name: Install apache2 package with php support + package: + name: + - "{{ apache_package }}" + - "{{ php_package }}" + state: latest + update_cache: yes + diff --git a/06-copying-files/inventory b/06-copying-files/inventory new file mode 100644 index 0000000..f42df84 --- /dev/null +++ b/06-copying-files/inventory @@ -0,0 +1,7 @@ +[web_servers] +10.0.0.7 +10.0.0.8 + +[db_servers] +10.0.0.5 +10.0.0.11 diff --git a/06-copying-files/site.yml b/06-copying-files/site.yml new file mode 100644 index 0000000..eae18be --- /dev/null +++ b/06-copying-files/site.yml @@ -0,0 +1,61 @@ +--- +- hosts: all + become: true + pre_tasks: + + - name: install updates for RHEL distros + tags: always + package: + update_only: yes + update_cache: yes + when: ansible_os_family == "RedHat" + + - name: install updates for Debian distros + tags: always + package: + upgrade: dist + update_cache: yes + when: ansible_os_family == "Debian" + +- hosts: all + become: true + tasks: + + - name: Install common packages + package: + name: + - htop + - neofetch + + + +- hosts: web_servers + become: true + tasks: + + - name: Install apache on web servers + tags: apache + package: + name: + - apache2 + - libapache2-mod-php + + - name: Copy html file + tags: website + copy: + src: default_site.html + dest: /var/www/html/index.html + owner: root + group: root + mode: 0644 + + +- hosts: db_servers + tags: db, el + become: true + tasks: + + - name: install mariadb package on db servers + package: + name: mariadb + state: latest