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]
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:
src: /etc/nginx/sites-available/web-{{ vhost_name }}.conf
dest: /etc/nginx/sites-enabled/web-{{ vhost_name }}.conf
state: link
- name: Restart Nginx
systemd:

View File

@ -13,13 +13,17 @@
state: directory
mode: '0744'
- name: Get keyring
- name: Add GPG keyring
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
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
apt:
@ -29,3 +33,9 @@
- containerd.io
- docker-compose-plugin
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
apt:
pkg:

View File

@ -2,23 +2,38 @@
- name: Download latest WP
get_url:
url: https://wordpress.org/latest.zip
dest: /var/www/{{ vhost_name }}
dest: /tmp/latest.zip
mode: '0660'
- name: Extract wordpress
unarchive:
src: /var/www/{{ vhost_name }}/latest.zip
dest: /var/www/{{ vhost_name }}
src: /tmp/latest.zip
dest: /var/www/
remote_src: yes
- name: Delete the wordpress zip
file:
state: absent
path: /var/www/{{ vhost_name }}/latest.zip
path: /tmp/latest.zip
- name: Setup permissions
- name: Create wwwroot
file:
path: /var/www/{{ vhost_name }}
owner: www-data
group: www-data
mode: '0644'
path: /var/www/{{ vhost_name}}
state: directory
mode: '0755'
- 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
template:
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
file:
@ -28,7 +34,7 @@
state: directory
mode: '0755'
- name: Create Redisdirs
- name: Create Redis dirs
file:
path: /opt/docker/redis
state: directory
@ -38,3 +44,9 @@
template:
src: files/redis.j2
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
vars_files:
- /vars/external.yml
- vars/external.yml
become: yes
become_user: root
gather_facts: true