Changeset - 5c2696aa6249
[Not reviewed]
1 1 1
x - 19 months ago 2023-10-09 19:59:48
xbr@c3l.lu
feat: add explanation for each web task file
2 files changed with 2 insertions and 0 deletions:
0 comments (0 inline, 0 general)
web/tasks/install_ansible.yml
Show inline comments
 
---
 
# This just installs acme.sh for freifunk
 
- name: Check if acme.sh config files exists
 
  ansible.builtin.stat:
 
    path: "/root/.acme.sh"
 
    get_checksum: false
 
  register: acme_config
 
- name: Download acme.sh
 
  ansible.builtin.get_url:
 
    url: "https://raw.githubusercontent.com/acmesh-official/acme.sh/master/acme.sh"
 
    dest: "/opt/downloaded_acme.sh"
 
    force: true
 
    mode: '755'
 
    owner: root
 
    group: root
 
  become: true
 
  become_method: sudo
 
  register: download_acme
 
  when: acme_config.stat.exists == false
 
- name: Install acme.sh
 
  ansible.builtin.command:
 
    cmd: "/bin/bash /opt/downloaded_acme.sh --install --nocron -m freifunk@c3l.lu"
 
  become: true
 
  become_method: sudo
 
  when: download_acme.changed && acme_config.stat.exists == false
 
- name: Update acme.sh if not newly installed
web/tasks/set_up_nginx_config.yml
Show inline comments
 
file renamed from web/set_up_nginx_config.yml to web/tasks/set_up_nginx_config.yml
 
---
 
# Sets up nginx for the specific config file
 
- name: Install nginx
 
  ansible.builtin.apt:
 
    name: nginx
 
    state: present
 
- name: Install nginx config
 
  ansible.builtin.copy:
 
    src: "{{ server_config_dir }}/server_config/nginx/configs/{{ web_conf_file }}"
 
    dest: "/etc/nginx/sites-available/"
 
    owner: root
 
    group: root
 
    mode: "0644"
 
  notify: Restart Nginx
 
- name: Enable new config site
 
  ansible.builtin.file:
 
    src: "/etc/nginx/sites-available/{{ web_conf_file }}"
 
    dest: "/etc/nginx/sites-enabled/{{ web_conf_file }}"
 
    owner: root
 
    group: root
 
    state: link
 
  notify: Restart Nginx
0 comments (0 inline, 0 general)