Skip to content

Commit

Permalink
major: used full qualified collection names
Browse files Browse the repository at this point in the history
  • Loading branch information
tboerger committed Feb 6, 2024
1 parent 9d9c7d0 commit 9b2e062
Show file tree
Hide file tree
Showing 7 changed files with 66 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
uses: actions/checkout@v4

- name: Role linting
uses: actionhippie/ansible-later@v2
uses: actionhippie/ansible-later@v3

testing:
runs-on: ubuntu-latest
Expand Down
4 changes: 2 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
---
- name: Restart loki
systemd:
ansible.builtin.systemd:
name: loki
state: restarted
daemon_reload: True

- name: Restart loki-oauth2
systemd:
ansible.builtin.systemd:
name: loki-oauth2
state: restarted
daemon_reload: yes
Expand Down
9 changes: 9 additions & 0 deletions meta/requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
collections:
- community.general
- community.docker

roles:
- name: rolehippie.docker

...
44 changes: 35 additions & 9 deletions molecule/default/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,48 @@
gather_facts: False

tasks:
- name: Stat apt dir
register: aptdir
ansible.builtin.stat:
path: /var/lib/apt

- name: Wait for aptlock
shell: while fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do echo 'Waiting for apt list lock.' && sleep 10; done
when: aptdir.stat.exists
changed_when: False
ansible.builtin.shell:
cmd: while fuser /var/lib/apt/lists/lock >/dev/null 2>&1; do echo 'Waiting for apt list lock.' && sleep 10; done

- name: Update package cache
apt:
when: aptdir.stat.exists
ansible.builtin.apt:
update_cache: True

- name: Install gpg dependency
apt:
name: python3-gpg
- name: Install test dependencies
when: aptdir.stat.exists
loop:
- python3-gpg
- curl
ansible.builtin.apt:
name: "{{ item }}"
state: present

- name: Install curl dependency
apt:
name: curl
state: present
- name: Create man dirs
changed_when: False
loop:
- /usr/share/man/man1
- /usr/share/man/man2
- /usr/share/man/man3
- /usr/share/man/man4
- /usr/share/man/man5
- /usr/share/man/man6
- /usr/share/man/man7
- /usr/share/man/man8
- /usr/share/man/man9
ansible.builtin.file:
path: "{{ item }}"
owner: root
group: root
mode: u=rwx,g=rx,o=rx
state: directory

...
5 changes: 4 additions & 1 deletion molecule/requirements.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
---
collections: []
collections:
- community.general
- community.docker

roles:
- name: rolehippie.docker

Expand Down
16 changes: 8 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Create required directories
loop: "{{ loki_default_folders + loki_extra_folders }}"
file:
ansible.builtin.file:
path: "{{ item }}"
owner: "10001"
group: "10001"
Expand All @@ -13,7 +13,7 @@
- name: Write general config
notify:
- Restart loki
template:
ansible.builtin.template:
src: config.j2
dest: /etc/loki/config.yml
owner: root
Expand All @@ -25,7 +25,7 @@
- name: Write default config
notify:
- Restart loki
template:
ansible.builtin.template:
src: default.j2
dest: /etc/default/loki
owner: root
Expand All @@ -37,7 +37,7 @@
- name: Write service file
notify:
- Restart loki
template:
ansible.builtin.template:
src: service.j2
dest: /etc/systemd/system/loki.service
owner: root
Expand All @@ -49,7 +49,7 @@
- name: Pull docker image
when:
- loki_pull_image
docker_image:
community.docker.docker_image:
name: "{{ loki_image }}"
source: pull
tags:
Expand All @@ -58,13 +58,13 @@
- name: Create docker network
when:
- loki_network | default(False)
docker_network:
community.docker.docker_network:
name: '{{ loki_network }}'
tags:
- loki

- name: Start loki service
systemd:
ansible.builtin.systemd:
name: loki
state: started
daemon_reload: True
Expand All @@ -75,7 +75,7 @@

- name: Include oauth2 tasks
when: loki_oauth2_enabled | default(False)
include_tasks: oauth2.yml
ansible.builtin.include_tasks: oauth2.yml
tags:
- loki
- oauth2
Expand Down
14 changes: 7 additions & 7 deletions tasks/oauth2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
loop:
- python3-passlib
- python3-bcrypt
package:
ansible.builtin.package:
name: "{{ item }}"
state: present
tags:
Expand All @@ -18,7 +18,7 @@
label: "{{ item.username }}"
notify:
- Restart loki-oauth2
htpasswd:
community.general.htpasswd:
path: /etc/loki/htpasswd
name: "{{ item.username }}"
password: "{{ item.password }}"
Expand All @@ -34,7 +34,7 @@
- name: Write default config
notify:
- Restart loki-oauth2
template:
ansible.builtin.template:
src: oauth2/default.j2
dest: /etc/default/loki-oauth2
owner: root
Expand All @@ -47,7 +47,7 @@
- name: Write service file
notify:
- Restart loki-oauth2
template:
ansible.builtin.template:
src: oauth2/service.j2
dest: /etc/systemd/system/loki-oauth2.service
owner: root
Expand All @@ -59,7 +59,7 @@

- name: Pull docker image
when: loki_oauth2_pull_image
docker_image:
community.docker.docker_image:
name: "{{ loki_oauth2_image }}"
source: pull
tags:
Expand All @@ -69,14 +69,14 @@
- name: Create docker network
when:
- loki_oauth2_network | default(False)
docker_network:
community.docker.docker_network:
name: '{{ loki_oauth2_network }}'
tags:
- loki
- oauth2

- name: Start loki-oauth2 service
systemd:
ansible.builtin.systemd:
name: loki-oauth2
state: started
daemon_reload: True
Expand Down

0 comments on commit 9b2e062

Please sign in to comment.