Bug fixes after testing

This commit is contained in:
David Petric 2023-03-28 10:24:45 +02:00
parent 5ff2c19628
commit 314c2a1527
7 changed files with 65 additions and 21 deletions

View File

@ -1,2 +1,2 @@
[main] [main]
xyz.com ansible_connection=ssh ansible_ssh_port=22 ansible_ssh_user=user xyz.com ansible_connection=ssh ansible_ssh_port=22 ansible_ssh_user=test ansible_sudo_pass=test ansible_ssh_private_key_file=/tmp/test.key

View File

@ -14,6 +14,7 @@
file: file:
src: /etc/nginx/sites-available/web-{{ vhost_name }}.conf src: /etc/nginx/sites-available/web-{{ vhost_name }}.conf
dest: /etc/nginx/sites-enabled/web-{{ vhost_name }}.conf dest: /etc/nginx/sites-enabled/web-{{ vhost_name }}.conf
state: link
- name: Restart Nginx - name: Restart Nginx
systemd: systemd:

View File

@ -13,13 +13,17 @@
state: directory state: directory
mode: '0744' mode: '0744'
- name: Get keyring - name: Add GPG keyring
become: true become: true
shell: curl -fsSL https://download.docker.com/linux/ubuntu/gpg | gpg --dearmor -o /etc/apt/keyrings/docker.gpg apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: Add repository - name: Add Docker repo
become: true become: true
shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-pluginsudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-pluginlinux/ubuntu $(lsb_release -cs) stable" | tee /etc/apt/sources.list.d/docker.list > /dev/null apt_repository:
repo: deb https://download.docker.com/linux/ubuntu focal stable
state: present
- name: Update repository and install docker - name: Update repository and install docker
apt: apt:
@ -29,3 +33,9 @@
- containerd.io - containerd.io
- docker-compose-plugin - docker-compose-plugin
update_cache: yes update_cache: yes
- name: Install Docker compose
get_url:
url: https://github.com/docker/compose/releases/download/v2.17.2/docker-compose-linux-x86_64
dest: /usr/local/bin/docker-compose
mode: 'u+x,g+x'

View File

@ -1,4 +1,10 @@
--- ---
- name: Failsafe - disable Apache if exists
systemd:
name: apache2
state: stopped
enabled: no
- name: Install Nginx - name: Install Nginx
apt: apt:
pkg: pkg:

View File

@ -2,23 +2,38 @@
- name: Download latest WP - name: Download latest WP
get_url: get_url:
url: https://wordpress.org/latest.zip url: https://wordpress.org/latest.zip
dest: /var/www/{{ vhost_name }} dest: /tmp/latest.zip
mode: '0660' mode: '0660'
- name: Extract wordpress - name: Extract wordpress
unarchive: unarchive:
src: /var/www/{{ vhost_name }}/latest.zip src: /tmp/latest.zip
dest: /var/www/{{ vhost_name }} dest: /var/www/
remote_src: yes remote_src: yes
- name: Delete the wordpress zip - name: Delete the wordpress zip
file: file:
state: absent state: absent
path: /var/www/{{ vhost_name }}/latest.zip path: /tmp/latest.zip
- name: Setup permissions - name: Create wwwroot
file: file:
path: /var/www/{{ vhost_name}} path: /var/www/{{ vhost_name}}
owner: www-data state: directory
group: www-data mode: '0755'
mode: '0644'
- name: Rename folder
shell: mv /var/www/wordpress/* /var/www/{{ vhost_name }}/
- name: Delete old folder
file:
path: /var/www/wordpress
state: absent
- name: Chown
become: true
shell: chown -R www-data:www-data /var/www/{{ vhost_name }}
- name: Chmod
become: true
shell: chmod -R 755 /var/www/{{ vhost_name }}

View File

@ -20,7 +20,13 @@
- name: Copy MySQL compose file - name: Copy MySQL compose file
template: template:
src: files/mysql.j2 src: files/mysql.j2
dest: /opt/docker/compose-files/mysql/docker-compose.yaml dest: /opt/docker/compose-files/mysql/docker-compose.yml
- name: Rise MySQL container
become: true
shell: docker-compose up -d
args:
chdir: /opt/docker/compose-files/mysql
- name: Create Redis dirs - name: Create Redis dirs
file: file:
@ -38,3 +44,9 @@
template: template:
src: files/redis.j2 src: files/redis.j2
dest: /opt/docker/compose-files/redis/docker-compose.yml dest: /opt/docker/compose-files/redis/docker-compose.yml
- name: Rise Redis container
become: true
shell: docker-compose up -d
args:
chdir: /opt/docker/compose-files/redis

View File

@ -1,7 +1,7 @@
--- ---
- hosts: all - hosts: all
vars_files: vars_files:
- /vars/external.yml - vars/external.yml
become: yes become: yes
become_user: root become_user: root
gather_facts: true gather_facts: true