fixing lint issues

pull/25/head
Cian Hatton 3 years ago
parent 7f505fe564
commit 9a10ee6c9d

@ -1,3 +1,4 @@
---
- hosts: localhost - hosts: localhost
become: true become: true
roles: roles:

@ -85,26 +85,26 @@
- name: Docker | Create required docker networks - name: Docker | Create required docker networks
docker_network: docker_network:
name: '{{item}}' name: '{{ item }}'
with_items: '{{ docker_networks }}' with_items: '{{ docker_networks }}'
- name: Portainer | Update Stack - name: Portainer | Update Stack
when: container_deployment_mode == "portainer" when: container_deployment_mode == "portainer"
chatton.portainer.portainer_stack: chatton.portainer.portainer_stack:
username: admin username: admin
password: '{{portainer.password}}' password: '{{ portainer.password }}'
docker_compose_file_path: '{{ directories.docker_compose_directory }}/{{ item.name }}/docker-compose.yml' docker_compose_file_path: '{{ directories.docker_compose_directory }}/{{ item.name }}/docker-compose.yml'
stack_name: '{{ item.name }}' stack_name: '{{ item.name }}'
endpoint_id: '{{ item.endpoint_id }}' endpoint_id: '{{ item.endpoint_id }}'
state: present state: present
with_items: '{{services}}' with_items: '{{ services }}'
- name: Docker compose | Update Stack - name: Docker compose | Update Stack
when: container_deployment_mode == "compose" when: container_deployment_mode == "compose"
docker_compose: docker_compose:
project_src: '{{directories.docker_compose_directory}}/{{ item.name }}' project_src: '{{ directories.docker_compose_directory }}/{{ item.name }}'
state: present state: present
with_items: '{{services}}' with_items: '{{ services }}'
- name: Install Ansible pull - name: Install Ansible pull
@ -122,7 +122,9 @@
minute: "*" minute: "*"
hour: "4" hour: "4"
user: "{{ homelab_user }}" user: "{{ homelab_user }}"
job: "/home/{{ homelab_user }}/.local/bin/ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=nightly >> ~/logs/nightly.log 2>&1" job: >
/home/{{ homelab_user }}/.local/bin/ansible-pull
-U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=nightly >> ~/logs/nightly.log 2>&1
cron_file: ansible_nightly_docker_volume_backup cron_file: ansible_nightly_docker_volume_backup
state: present state: present
@ -131,8 +133,10 @@
ansible.builtin.cron: ansible.builtin.cron:
name: backup docker volumes (monthly) name: backup docker volumes (monthly)
month: "*" month: "*"
day : "1" day: "1"
user: "{{ homelab_user }}" user: "{{ homelab_user }}"
job: "/home/{{ homelab_user }}/.local/bin/ansible-pull -U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=monthly >> ~/logs/monthly.log 2>&1" job: >
/home/{{ homelab_user }}/.local/bin/ansible-pull
-U https://github.com/chatton/ansible-homelab playbooks/backup-docker-volumes.yml -e schedule=monthly >> ~/logs/monthly.log 2>&1
cron_file: ansible_monthly_docker_volume_backup cron_file: ansible_monthly_docker_volume_backup
state: present state: present

@ -1,7 +1,12 @@
$ANSIBLE_VAULT;1.1;AES256 36356161663039666634393933383830653035633438343866643730303434353632383031303965 $ANSIBLE_VAULT;1.1;AES256
3465343332353437616663643662343262373333366162300a373662386533363234636234633339 35383439373430656130353938653531636563663066646265643838323230356231333836326262 38343033383061343739363362626366376630376337376639376235316665363736376362633830
6439626538643837390a383039373366626637333738386332356361306131323133383534323462 32376564376363663666383639313064316365353037356633363035373632313561643030643933 6638383135303063363866623262303736393337386364630a353533323537376437343033666334
34663533313231636162306465656433663634643038343938396462643261656238626432633136 39356562353463353034373534386537313634326534623830616362336638396337386631663538 32353832353466343832643238313834616662333736363738353565623063316438393635343631
30663236653532316461306636333536373836626537363430613961346137626261333238366234 30633438653936316539326436393634366236616664383835396434373966333166366265636661 6662366132396337320a326335353333306262666561353037356539633432376439666133386463
39666335653265323565313831303264336331363339333532353939653330383362363965353032 383434386133323961373833303262336439 30326230316634346431346266333030303435313065616665656362663164313638313639313633
... 63343538653230653330383336386138643636333361326139346336646665366530343537663331
61303639313335343162613838303034616362303935653862666166656634613562376330306165
32373832666438623638616363363931636664633337396336653237356234616438623261353134
62373463313235323233343734363561353237613439663534393537333964323932373837356564
32383536613332323532633534306632373762666236366664383636323264363433396437666437
323637336362613139633237316237666365

@ -1,12 +1,11 @@
# defaults file for setup_linode
ssh_keys: ssh_keys:
- "{{ lookup('file', '~/.ssh/id_rsa.pub') }}" - "{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
label: simple-linode label: simple-linode
# hosts that are added to the generated .ini file. # hosts that are added to the generated .ini file.
hosts: linode_hosts:
- user: root - user: root
ip: '{{my_linode.instance.ipv4[0]}}' ip: '{{ my_linode.instance.ipv4[0] }}'
# https://www.linode.com/community/questions/17190/obtain-a-list-of-image-and-plan-types-using-linode-apicli # https://www.linode.com/community/questions/17190/obtain-a-list-of-image-and-plan-types-using-linode-apicli
type: g6-standard-2 type: g6-standard-2

@ -1,53 +1,13 @@
galaxy_info: galaxy_info:
author: Cian Hatton author: Cian Hatton
namespace: chatton namespace: chatton
description: your role description description: Setup Linode instance
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: MIT license: MIT
min_ansible_version: 2.1 min_ansible_version: "2.1"
platforms:
# If this a Container Enabled role, provide the minimum Ansible Container version. - name: Debian
# min_ansible_container_version: versions:
- all
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: [] galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

@ -1,5 +1,6 @@
---
- name: Include vault variables. - name: Include vault variables.
include_vars: defaults/main-vault.yml ansible.builtin.include_vars: defaults/main-vault.yml
- name: Create a new Linode. - name: Create a new Linode.
linode_v4: linode_v4:
@ -15,19 +16,22 @@
register: my_linode register: my_linode
- name: Wait for SSH to come up - name: Wait for SSH to come up
local_action: delegate_to: localhost
module: wait_for host={{ my_linode.instance.ipv4[0] }} port=22 search_regex=OpenSSH ansible.builtin.wait_for:
timeout=320 host: "{{ my_linode.instance.ipv4[0] }}"
port: 22
search_regex: OpenSSH
timeout: 320
- name: Instance Details - name: Instance Details
debug: ansible.builtin.debug:
msg: '{{my_linode}}' msg: '{{ my_linode }}'
- name: Update hosts.ini # - name: Update hosts.ini
blockinfile: # blockinfile:
path: hosts.ini # path: hosts.ini
block: | # block: |
[linode] # [linode]
{% for host in hosts %} # {% for host in linode_hosts %}
{{host.user}}@{{host.ip}} # {{ host.user }}@{{ host.ip }}
{% endfor %} # {% endfor %}

@ -1,53 +1,11 @@
galaxy_info: galaxy_info:
author: Cian Hatton author: Cian Hatton
namespace: chatton namespace: chatton
description: your role description description: Configures Mergerfs
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: MIT license: MIT
min_ansible_version: "2.1"
min_ansible_version: 2.1 platforms:
- name: Debian
# If this a Container Enabled role, provide the minimum Ansible Container version. versions:
# min_ansible_container_version: - all
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: [] dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

@ -1,26 +1,22 @@
# dangerous to use this as the device name changes when there are new drives. ---
# can this be done with an ID?
#- name: Create a ext4 filesystem on /dev/sdb1
# filesystem:
# fstype: ext4
# dev: /dev/sdb1
# state: present
- name: Mount Volumes - name: Mount Volumes
mount: ansible.builtin.mount:
path: '{{item.path}}' path: '{{ item.path }}'
src: UUID={{item.uuid}} src: UUID={{ item.uuid }}
fstype: ext4 fstype: ext4
state: mounted state: mounted
opts: defaults,nofail opts: defaults,nofail
loop: '{{ devices }}' loop: '{{ devices }}'
register: volume_out register: volume_out
- debug: msg="{{volume_out}}" - name: Display volumes.
ansible.builtin.debug:
var: "{{ volume_out }}"
verbosity: 3
# tasks file for setup_mergerfs # tasks file for setup_mergerfs
- name: Create Mergerfs directory - name: Create Mergerfs directory
file: ansible.builtin.file:
path: /mnt/mergerfs path: /mnt/mergerfs
state: directory state: directory
owner: cianhatton owner: cianhatton
@ -30,11 +26,11 @@
# Ensure the actual folder can't be written to only when it has just been created. # Ensure the actual folder can't be written to only when it has just been created.
- name: Make /mnt/mergerfs immutable - name: Make /mnt/mergerfs immutable
command: chattr +i /mnt/mergerfs ansible.builtin.command: chattr +i /mnt/mergerfs
when: directory_creation.changed == true when: directory_creation.diff.after.path != directory_creation.diff.before.path
- name: Create Mergerfs pool - name: Create Mergerfs pool
include_role: ansible.builtin.include_role:
name: sprat.mergerfs name: sprat.mergerfs
vars: vars:
mergerfs_mounts: '{{ mounts }}' mergerfs_mounts: '{{ mounts }}'

@ -3,12 +3,17 @@
ansible.builtin.file: ansible.builtin.file:
path: '{{ directories.docker_compose_directory }}' path: '{{ directories.docker_compose_directory }}'
state: directory state: directory
mode: '0755' owner: root
group: root
mode: 0440
- name: Portainer | Copy docker compose file. - name: Portainer | Copy docker compose file.
ansible.builtin.copy: ansible.builtin.copy:
src: docker-compose.yml src: docker-compose.yml
dest: '{{ directories.docker_compose_directory }}/docker-compose.yml' dest: '{{ directories.docker_compose_directory }}/docker-compose.yml'
owner: root
group: root
mode: 0440
- name: Portainer | Check if volume exists - name: Portainer | Check if volume exists
ansible.builtin.shell: docker volume ls -f name=portainer_portainer_data --format '{{ '{{' }} .Name {{ '}}' }}' ansible.builtin.shell: docker volume ls -f name=portainer_portainer_data --format '{{ '{{' }} .Name {{ '}}' }}'

Loading…
Cancel
Save