diff --git a/act_playbook.yml b/act_playbook.yml index 66c924b..36538db 100644 --- a/act_playbook.yml +++ b/act_playbook.yml @@ -11,7 +11,7 @@ - name: Gather subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: wzzrd.gitea.act diff --git a/galaxy.yml b/galaxy.yml index 6793fe4..420763e 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,3 +1,4 @@ +--- ### REQUIRED # The namespace of the collection. This can be a company/brand/organization or product namespace under which all # content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with @@ -18,7 +19,6 @@ readme: README.md authors: - Maxim Burgerhout - ### OPTIONAL but strongly recommended # A short summary description of the collection description: A collection to configure a private Gitea instance and act_runners @@ -41,7 +41,6 @@ tags: # L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version # range specifiers can be set and are separated by ',' dependencies: {} - # The URL of the originating SCM repository repository: https://github.com/wzzrd/ansible-collection-gitea diff --git a/gitea_playbook.yml b/gitea_playbook.yml index 9bf27fc..f934631 100644 --- a/gitea_playbook.yml +++ b/gitea_playbook.yml @@ -10,7 +10,7 @@ - name: Gather subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: wzzrd.gitea.gitea diff --git a/meta/runtime.yml b/meta/runtime.yml index f3589f4..060499f 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,7 +1,7 @@ --- # Collections must specify a minimum required ansible version to upload # to galaxy -requires_ansible: '>=2.15.0' +requires_ansible: ">=2.15.0" # Content that Ansible needs to load from another location or that has # been deprecated/removed diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 61b09af..4ee6359 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -1,3 +1,4 @@ +--- - name: Fail if runner or server groups are missing hosts: localhost tasks: @@ -16,7 +17,7 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" - default_ipv4 roles: @@ -44,6 +45,6 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: act diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0d88566..43210ff 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -13,10 +13,10 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 networks: - - name: "gitea" + - name: gitea - name: ubi9_runner image: registry.access.redhat.com/ubi9/ubi-init pre_built_image: true @@ -26,10 +26,10 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 networks: - - name: "gitea" + - name: gitea - name: ubi8_server image: registry.access.redhat.com/ubi8/ubi-init pre_built_image: true @@ -41,10 +41,10 @@ platforms: published_ports: - 3000/tcp privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 networks: - - name: "gitea" + - name: gitea - name: ubi9_server image: registry.access.redhat.com/ubi9/ubi-init pre_built_image: true @@ -56,10 +56,10 @@ platforms: published_ports: - 3000/tcp privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 networks: - - name: "gitea" + - name: gitea provisioner: name: ansible env: diff --git a/molecule/default/prepare.yml b/molecule/default/prepare.yml index 749da8e..3cb5344 100644 --- a/molecule/default/prepare.yml +++ b/molecule/default/prepare.yml @@ -1,3 +1,4 @@ +--- - name: Prepare servers for molecule tests hosts: servers:runners gather_facts: false diff --git a/molecule/default/requirements.yml b/molecule/default/requirements.yml index 836720a..86847f0 100644 --- a/molecule/default/requirements.yml +++ b/molecule/default/requirements.yml @@ -1,3 +1,4 @@ +--- collections: - containers.podman - community.general diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 8a8778b..fd58f55 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -1,3 +1,4 @@ +--- - name: Verify hosts: runners gather_facts: false @@ -15,12 +16,11 @@ that: - act_runner_stat_result.stat.exists - - name: Check if gitea configfile exists block: - name: Check for existence of /home/builder/config.yaml ansible.builtin.stat: - path: "/home/act_runner/config.yaml" + path: /home/act_runner/config.yaml register: act_runner_config_stat_result - name: Verify result of previous task @@ -59,7 +59,6 @@ that: - gitea_stat_result.stat.exists - - name: Check if gitea configfile exists block: - name: Check for existence of /etc/gitea/gitea.ini diff --git a/roles/act/defaults/main.yml b/roles/act/defaults/main.yml index 8d6baec..28eb110 100644 --- a/roles/act/defaults/main.yml +++ b/roles/act/defaults/main.yml @@ -2,7 +2,7 @@ act_install_dependencies: true act_user: act_runner act_user_group: act_runner -act_user_additional_groups: '' +act_user_additional_groups: "" act_user_home: /home/{{ act_user }} act_bin_dir: /usr/local/bin @@ -10,14 +10,14 @@ act_bin_owner: root act_bin_owner_group: root act_runner_version: "0.2.6" -act_download_dir_url: "https://dl.gitea.com/act_runner/{{ act_runner_version }}" +act_download_dir_url: https://dl.gitea.com/act_runner/{{ act_runner_version }} # An empty value for act_config_content will generate a default config.yaml -act_config_content: '' +act_config_content: "" act_gitea_config_path: /etc/gitea/gitea.ini act_do_register: false # For a scoped runner, enter owner/repo, for global runner leave as '' -act_scope: '' +act_scope: "" act_gitea_host: gitea.example.com act_gitea_host_port: 443 diff --git a/roles/act/handlers/main.yml b/roles/act/handlers/main.yml index a063148..d02a233 100644 --- a/roles/act/handlers/main.yml +++ b/roles/act/handlers/main.yml @@ -1,9 +1,9 @@ --- -- name: "Restart act_runner" +- name: Restart act_runner ansible.builtin.service: name: act_runner state: restarted -- name: "Reload systemd" +- name: Reload systemd ansible.builtin.systemd: daemon_reload: true diff --git a/roles/act/meta/main.yml b/roles/act/meta/main.yml index c315622..ab66559 100644 --- a/roles/act/meta/main.yml +++ b/roles/act/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: Maxim Burgerhout description: Configure an act_runner instance for a Gitea server @@ -11,10 +12,10 @@ galaxy_info: min_ansible_version: "2.13" platforms: - - name: "Fedora" + - name: Fedora versions: - all - - name: "EL" + - name: EL versions: - "8" - "9" diff --git a/roles/act/molecule/default/converge.yml b/roles/act/molecule/default/converge.yml index 3bc0de3..27e03c2 100644 --- a/roles/act/molecule/default/converge.yml +++ b/roles/act/molecule/default/converge.yml @@ -1,3 +1,4 @@ +--- - name: Converge hosts: all # We disable gather facts because it would fail due to our container not @@ -9,7 +10,7 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: act diff --git a/roles/act/molecule/default/molecule.yml b/roles/act/molecule/default/molecule.yml index 8f409a3..6c25ea8 100644 --- a/roles/act/molecule/default/molecule.yml +++ b/roles/act/molecule/default/molecule.yml @@ -11,7 +11,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 - name: ubi9 image: registry.access.redhat.com/ubi9/ubi-init:latest @@ -20,7 +20,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 provisioner: name: ansible diff --git a/roles/act/molecule/default/prepare.yml b/roles/act/molecule/default/prepare.yml index 1942fb1..5f76d0c 100644 --- a/roles/act/molecule/default/prepare.yml +++ b/roles/act/molecule/default/prepare.yml @@ -1,3 +1,4 @@ +--- - name: Prepare containers for molecule tests hosts: all gather_facts: false diff --git a/roles/act/molecule/default/requirements.yml b/roles/act/molecule/default/requirements.yml index 6c36796..68b4a8e 100644 --- a/roles/act/molecule/default/requirements.yml +++ b/roles/act/molecule/default/requirements.yml @@ -1,2 +1,3 @@ +--- collections: - containers.podman diff --git a/roles/act/molecule/default/verify.yml b/roles/act/molecule/default/verify.yml index 00503b7..6ffeb9d 100644 --- a/roles/act/molecule/default/verify.yml +++ b/roles/act/molecule/default/verify.yml @@ -1,3 +1,4 @@ +--- - name: Verify hosts: all # We disable gather facts because it would fail due to our container not @@ -19,12 +20,11 @@ that: - act_runner_stat_result.stat.exists - - name: Check if gitea configfile exists block: - name: Check for existence of /home/builder/config.yaml ansible.builtin.stat: - path: "/home/act_runner/config.yaml" + path: /home/act_runner/config.yaml register: act_runner_config_stat_result - name: Verify result of previous task diff --git a/roles/act/molecule/update/converge.yml b/roles/act/molecule/update/converge.yml index 9f345be..6109c6b 100644 --- a/roles/act/molecule/update/converge.yml +++ b/roles/act/molecule/update/converge.yml @@ -1,3 +1,4 @@ +--- - name: Converge act_runner 0.2.6 hosts: all gather_facts: false @@ -7,7 +8,7 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: act @@ -21,7 +22,7 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" roles: - role: act diff --git a/roles/act/molecule/update/molecule.yml b/roles/act/molecule/update/molecule.yml index 1b77d30..2118494 100644 --- a/roles/act/molecule/update/molecule.yml +++ b/roles/act/molecule/update/molecule.yml @@ -11,7 +11,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 - name: ubi9 image: registry.access.redhat.com/ubi9/ubi-init @@ -20,7 +20,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 provisioner: name: ansible diff --git a/roles/act/molecule/update/prepare.yml b/roles/act/molecule/update/prepare.yml index 5fb8ac4..61a16da 100644 --- a/roles/act/molecule/update/prepare.yml +++ b/roles/act/molecule/update/prepare.yml @@ -1,3 +1,4 @@ +--- - name: Prepare containers for molecule tests hosts: all gather_facts: false diff --git a/roles/act/molecule/update/requirements.yml b/roles/act/molecule/update/requirements.yml index 836720a..86847f0 100644 --- a/roles/act/molecule/update/requirements.yml +++ b/roles/act/molecule/update/requirements.yml @@ -1,3 +1,4 @@ +--- collections: - containers.podman - community.general diff --git a/roles/act/molecule/update/verify.yml b/roles/act/molecule/update/verify.yml index 9b57411..c01b43d 100644 --- a/roles/act/molecule/update/verify.yml +++ b/roles/act/molecule/update/verify.yml @@ -1,3 +1,4 @@ +--- - name: Verify hosts: all # We disable gather facts because it would fail due to our container not diff --git a/roles/act/tasks/main.yml b/roles/act/tasks/main.yml index b822b49..89dfa30 100644 --- a/roles/act/tasks/main.yml +++ b/roles/act/tasks/main.yml @@ -1,10 +1,9 @@ --- - name: Ensure installation of podman-docker ansible.builtin.dnf: - name: "{{ item }}" + name: + - podman-docker state: present - loop: - - podman-docker when: act_install_dependencies is true - name: Add group for act user @@ -26,8 +25,8 @@ - name: Deploy systemd service file ansible.builtin.template: - src: "act_runner.service.j2" - dest: "/etc/systemd/system/act_runner.service" + src: act_runner.service.j2 + dest: /etc/systemd/system/act_runner.service mode: "0644" notify: - Reload systemd @@ -58,8 +57,7 @@ - debug - name: Download and install new binary, if needed - when: (detected_version is not defined) or - (act_runner_version != detected_version[1:]) + when: (detected_version is not defined) or (act_runner_version != detected_version[1:]) notify: Restart act_runner tags: - version @@ -67,13 +65,13 @@ - name: Get system architecture in supported format - amd64 ansible.builtin.set_fact: act_architecture: amd64 - act_artifact: "act_runner-{{ act_runner_version }}-linux-amd64.xz" + act_artifact: act_runner-{{ act_runner_version }}-linux-amd64.xz when: ansible_architecture == "x86_64" - name: Get system architecture in supported format - arm64 ansible.builtin.set_fact: act_architecture: arm64 - act_artifact: "act_runner-{{ act_runner_version }}-linux-arm64.xz" + act_artifact: act_runner-{{ act_runner_version }}-linux-arm64.xz when: ansible_architecture == "aarch64" - name: Show artifact @@ -127,7 +125,7 @@ - "{{ act_user_home }}/{{ act_artifact }}" creates: "{{ act_user_home }}/{{ act_artifact[:-3] }}" - - name: "Copy file to {{ act_bin_dir }}" + - name: Copy file to {{ act_bin_dir }} ansible.builtin.copy: src: "{{ act_user_home }}/{{ act_artifact[:-3] }}" dest: "{{ act_bin_dir }}/{{ act_artifact[:-3] }}" @@ -140,7 +138,7 @@ ansible.builtin.file: src: "{{ act_bin_dir }}/{{ act_artifact[:-3] }}" dest: "{{ act_bin_dir }}/act_runner" - state: "link" + state: link - name: Generate default act config file contents if it doesn't exist ansible.builtin.command: @@ -247,9 +245,7 @@ - "{{ act_bin_dir }}/act_runner" - register - --instance - - "{{ act_gitea_host_protocol }}://\ - {{ act_gitea_host }}:\ - {{ act_gitea_host_port }}" + - "{{ act_gitea_host_protocol }}://{{ act_gitea_host }}:{{ act_gitea_host_port }}" - --labels - "{{ act_labels | join(',') }}" - --token diff --git a/roles/gitea/defaults/main.yml b/roles/gitea/defaults/main.yml index c90b176..e8d4e15 100644 --- a/roles/gitea/defaults/main.yml +++ b/roles/gitea/defaults/main.yml @@ -1,30 +1,30 @@ --- -gitea_version: "1.21.4" +gitea_version: 1.21.4 gitea_version_check: true -gitea_dl_url: "https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }}" -gitea_gpg_key: "7C9E68152594688862D62AF62D9AE806EC1592E2" -gitea_gpg_server: "hkp://keyserver.ubuntu.com:80" +gitea_dl_url: https://github.com/go-gitea/gitea/releases/download/v{{ gitea_version }}/gitea-{{ gitea_version }}-linux-{{ gitea_arch }} +gitea_gpg_key: 7C9E68152594688862D62AF62D9AE806EC1592E2 +gitea_gpg_server: hkp://keyserver.ubuntu.com:80 gitea_backup_location: /var/backups/gitea gitea_do_backup: false gitea_systemd_cap_net_bind_service: false -gitea_app_name: "Gitea" -gitea_user: "gitea" -gitea_group: "gitea" -gitea_shell: "/bin/false" -gitea_home: "/var/lib/gitea" +gitea_app_name: Gitea +gitea_user: gitea +gitea_group: gitea +gitea_shell: /bin/false +gitea_home: /var/lib/gitea gitea_repository_root: "{{ gitea_home }}" -gitea_http_domain: "localhost" +gitea_http_domain: localhost gitea_http_port: "3000" -gitea_http_host: "127.0.0.1" -gitea_root_url: "http://{{ gitea_http_domain }}:{{ gitea_http_port }}" +gitea_http_host: 127.0.0.1 +gitea_root_url: http://{{ gitea_http_domain }}:{{ gitea_http_port }} gitea_config_file: DEFAULT: APP_NAME: "Gitea: Git with a cup of tea" RUN_USER: "{{ gitea_user }}" - WORK_PATH: "/usr/local/bin" + WORK_PATH: /usr/local/bin server: APP_DATA_PATH: "{{ gitea_home }}/data" DOMAIN: "{{ gitea_http_domain }}" @@ -33,11 +33,11 @@ gitea_config_file: HTTP_PORT: "{{ gitea_http_port }}" START_SSH_SERVER: "false" database: - DB_TYPE: "sqlite3" + DB_TYPE: sqlite3 security: INSTALL_LOCK: "true" - SECRET_KEY_URI: "file:/etc/gitea/secret_key" - INTERNAL_TOKEN_URI: "file:/etc/gitea/internal_token" + SECRET_KEY_URI: file:/etc/gitea/secret_key + INTERNAL_TOKEN_URI: file:/etc/gitea/internal_token oauth2: ENABLED: "false" service: @@ -49,5 +49,5 @@ gitea_config_file: ROOT: "{{ gitea_home }}" ui: SHOW_USER_EMAIL: "false" - DEFAULT_THEME: "gitea-auto" - THEMES: "gitea-auto,gitea-light,gitea-dark" + DEFAULT_THEME: gitea-auto + THEMES: gitea-auto,gitea-light,gitea-dark diff --git a/roles/gitea/handlers/main.yml b/roles/gitea/handlers/main.yml index f27d666..ff4a2b6 100644 --- a/roles/gitea/handlers/main.yml +++ b/roles/gitea/handlers/main.yml @@ -1,11 +1,11 @@ --- -- name: "Restart gitea" +- name: Restart gitea ansible.builtin.service: name: gitea state: restarted when: ansible_service_mgr == "systemd" -- name: "Reload systemd" +- name: Reload systemd ansible.builtin.systemd: daemon_reload: true when: ansible_service_mgr == "systemd" diff --git a/roles/gitea/meta/main.yml b/roles/gitea/meta/main.yml index 8aeeb21..1e04f74 100644 --- a/roles/gitea/meta/main.yml +++ b/roles/gitea/meta/main.yml @@ -1,3 +1,4 @@ +--- galaxy_info: author: Maxim Burgerhout description: Configure a Gitea server @@ -11,10 +12,10 @@ galaxy_info: min_ansible_version: "2.13" platforms: - - name: "Fedora" + - name: Fedora versions: - all - - name: "EL" + - name: EL versions: - "8" - "9" diff --git a/roles/gitea/molecule/default/converge.yml b/roles/gitea/molecule/default/converge.yml index 3863417..d89ce2d 100644 --- a/roles/gitea/molecule/default/converge.yml +++ b/roles/gitea/molecule/default/converge.yml @@ -1,3 +1,4 @@ +--- - name: Converge gitea server hosts: all # We disable gather facts because it would fail due to our container not @@ -10,7 +11,7 @@ - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" - default_ipv4 roles: diff --git a/roles/gitea/molecule/default/molecule.yml b/roles/gitea/molecule/default/molecule.yml index d00c7a8..ea5cbc5 100644 --- a/roles/gitea/molecule/default/molecule.yml +++ b/roles/gitea/molecule/default/molecule.yml @@ -11,7 +11,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 - name: ubi9 image: registry.access.redhat.com/ubi9/ubi-init @@ -20,7 +20,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 provisioner: name: ansible diff --git a/roles/gitea/molecule/default/prepare.yml b/roles/gitea/molecule/default/prepare.yml index 04b302a..a497291 100644 --- a/roles/gitea/molecule/default/prepare.yml +++ b/roles/gitea/molecule/default/prepare.yml @@ -1,3 +1,4 @@ +--- - name: Prepare containers for molecule tests hosts: all gather_facts: false diff --git a/roles/gitea/molecule/default/requirements.yml b/roles/gitea/molecule/default/requirements.yml index 836720a..86847f0 100644 --- a/roles/gitea/molecule/default/requirements.yml +++ b/roles/gitea/molecule/default/requirements.yml @@ -1,3 +1,4 @@ +--- collections: - containers.podman - community.general diff --git a/roles/gitea/molecule/default/verify.yml b/roles/gitea/molecule/default/verify.yml index 9929816..e350835 100644 --- a/roles/gitea/molecule/default/verify.yml +++ b/roles/gitea/molecule/default/verify.yml @@ -1,3 +1,4 @@ +--- - name: Verify hosts: all gather_facts: false diff --git a/roles/gitea/molecule/update/converge.yml b/roles/gitea/molecule/update/converge.yml index 5bfe72f..61d139e 100644 --- a/roles/gitea/molecule/update/converge.yml +++ b/roles/gitea/molecule/update/converge.yml @@ -1,14 +1,15 @@ +--- - name: Converge gitea server on 1.21.5 hosts: all gather_facts: false vars: - gitea_version: "1.21.5" + gitea_version: 1.21.5 gitea_do_backup: true pre_tasks: - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" - default_ipv4 roles: @@ -18,13 +19,13 @@ hosts: all gather_facts: false vars: - gitea_version: "1.21.7" + gitea_version: 1.21.7 gitea_do_backup: true pre_tasks: - name: Gather required subset of facts ansible.builtin.setup: gather_subset: - - '!all' + - "!all" - default_ipv4 roles: diff --git a/roles/gitea/molecule/update/molecule.yml b/roles/gitea/molecule/update/molecule.yml index 1b77d30..2118494 100644 --- a/roles/gitea/molecule/update/molecule.yml +++ b/roles/gitea/molecule/update/molecule.yml @@ -11,7 +11,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 - name: ubi9 image: registry.access.redhat.com/ubi9/ubi-init @@ -20,7 +20,7 @@ platforms: volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw privileged: true - command: "/usr/sbin/init" + command: /usr/sbin/init platform: linux/amd64 provisioner: name: ansible diff --git a/roles/gitea/molecule/update/prepare.yml b/roles/gitea/molecule/update/prepare.yml index 04b302a..a497291 100644 --- a/roles/gitea/molecule/update/prepare.yml +++ b/roles/gitea/molecule/update/prepare.yml @@ -1,3 +1,4 @@ +--- - name: Prepare containers for molecule tests hosts: all gather_facts: false diff --git a/roles/gitea/molecule/update/requirements.yml b/roles/gitea/molecule/update/requirements.yml index 836720a..86847f0 100644 --- a/roles/gitea/molecule/update/requirements.yml +++ b/roles/gitea/molecule/update/requirements.yml @@ -1,3 +1,4 @@ +--- collections: - containers.podman - community.general diff --git a/roles/gitea/molecule/update/verify.yml b/roles/gitea/molecule/update/verify.yml index 026ad21..7f2f829 100644 --- a/roles/gitea/molecule/update/verify.yml +++ b/roles/gitea/molecule/update/verify.yml @@ -1,3 +1,4 @@ +--- - name: Verify hosts: all # We disable gather facts because it would fail due to our container not diff --git a/roles/gitea/tasks/backup.yml b/roles/gitea/tasks/backup.yml index 3c463d4..f7dd222 100644 --- a/roles/gitea/tasks/backup.yml +++ b/roles/gitea/tasks/backup.yml @@ -1,5 +1,5 @@ --- -- name: "Create backup directory" +- name: Create backup directory ansible.builtin.file: path: "{{ gitea_backup_location }}" state: directory diff --git a/roles/gitea/tasks/create_user.yml b/roles/gitea/tasks/create_user.yml index 284e522..65b8b61 100644 --- a/roles/gitea/tasks/create_user.yml +++ b/roles/gitea/tasks/create_user.yml @@ -1,14 +1,14 @@ --- -- name: "Create Gitea Group" +- name: Create Gitea Group ansible.builtin.group: name: "{{ gitea_group }}" system: true - state: "present" + state: present -- name: "Create Gitea user" +- name: Create Gitea user ansible.builtin.user: name: "{{ gitea_user }}" - comment: "Gitea user" + comment: Gitea user home: "{{ gitea_home }}" shell: "{{ gitea_shell }}" system: true diff --git a/roles/gitea/tasks/install.yml b/roles/gitea/tasks/install.yml index 14dfea6..d3f43c9 100644 --- a/roles/gitea/tasks/install.yml +++ b/roles/gitea/tasks/install.yml @@ -40,14 +40,13 @@ - gitea_do_backup - name: Downloading and installing gitea binary - when: (not gitea_version_check|bool) or - (not ansible_check_mode and (gitea_active_version.stdout != gitea_version)) + when: (not gitea_version_check|bool) or (not ansible_check_mode and (gitea_active_version.stdout != gitea_version)) block: - name: Download gitea archive ansible.builtin.get_url: url: "{{ gitea_dl_url }}.xz" - dest: "/tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz" - checksum: "sha256:{{ gitea_dl_url }}.xz.sha256" + dest: /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz + checksum: sha256:{{ gitea_dl_url }}.xz.sha256 mode: "0644" register: _download_archive until: _download_archive is succeeded @@ -57,7 +56,7 @@ - name: Download gitea asc file ansible.builtin.get_url: url: "{{ gitea_dl_url }}.xz.asc" - dest: "/tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz.asc" + dest: /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz.asc mode: "0644" register: _download_asc until: _download_asc is succeeded @@ -79,22 +78,22 @@ - name: Check archive signature ansible.builtin.command: | - gpg --verify \ - /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz.asc \ - /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz + gpg --verify \ + /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz.asc \ + /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz changed_when: false - name: Unpack gitea binary ansible.builtin.command: - cmd: "xz -k -d /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz" - creates: "/tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}" + cmd: xz -k -d /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}.xz + creates: /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }} - name: Propagate gitea binary ansible.builtin.copy: - src: "/tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }}" + src: /tmp/gitea-{{ gitea_version }}.linux-{{ gitea_arch }} remote_src: true - dest: "/usr/local/bin/gitea" + dest: /usr/local/bin/gitea mode: "0755" owner: root group: root - notify: "Restart gitea" + notify: Restart gitea diff --git a/roles/gitea/tasks/install_systemd.yml b/roles/gitea/tasks/install_systemd.yml index c76971f..557b054 100644 --- a/roles/gitea/tasks/install_systemd.yml +++ b/roles/gitea/tasks/install_systemd.yml @@ -1,5 +1,5 @@ --- -- name: "Setup systemd service" +- name: Setup systemd service ansible.builtin.template: src: gitea.service.j2 dest: /lib/systemd/system/gitea.service @@ -7,11 +7,11 @@ group: root mode: "0644" notify: - - "Reload systemd" - - "Restart gitea" + - Reload systemd + - Restart gitea # systemd to be reloaded the first time because # it is the only way Systemd is going to be aware of the new unit file. -- name: "Reload systemd" +- name: Reload systemd ansible.builtin.systemd: daemon_reload: true diff --git a/roles/gitea/tasks/internal_token.yml b/roles/gitea/tasks/internal_token.yml index 0fc4983..b4f2e96 100644 --- a/roles/gitea/tasks/internal_token.yml +++ b/roles/gitea/tasks/internal_token.yml @@ -25,8 +25,8 @@ ansible.builtin.file: path: /etc/gitea/internal_token mode: "0600" - owner: "gitea" - group: "gitea" + owner: gitea + group: gitea - name: Create dictionary to hold internal_token uri ansible.builtin.set_fact: diff --git a/roles/gitea/tasks/lfs_jwt_secret.yml b/roles/gitea/tasks/lfs_jwt_secret.yml index 7deea74..bfde8e5 100644 --- a/roles/gitea/tasks/lfs_jwt_secret.yml +++ b/roles/gitea/tasks/lfs_jwt_secret.yml @@ -25,8 +25,8 @@ ansible.builtin.file: path: /etc/gitea/lfs_jwt_secret mode: "0600" - owner: "gitea" - group: "gitea" + owner: gitea + group: gitea - name: Create dictionary to hold lfs_jwt_secret uri ansible.builtin.set_fact: diff --git a/roles/gitea/tasks/main.yml b/roles/gitea/tasks/main.yml index f5a4768..38b10d2 100644 --- a/roles/gitea/tasks/main.yml +++ b/roles/gitea/tasks/main.yml @@ -32,8 +32,8 @@ state: directory owner: "{{ gitea_user }}" group: "{{ gitea_group }}" - mode: '0755' - with_items: + mode: "0755" + loop: - /etc/gitea - name: Create data directory @@ -43,7 +43,7 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: "0750" - with_items: + loop: - "{{ gitea_home }}" - "{{ gitea_home }}/data" - "{{ gitea_home }}/custom" @@ -79,9 +79,9 @@ owner: "{{ gitea_user }}" group: "{{ gitea_group }}" mode: "0600" - notify: "Restart gitea" + notify: Restart gitea -- name: "Service gitea" +- name: Service gitea ansible.builtin.service: name: gitea state: started diff --git a/roles/gitea/tasks/oauth2_jwt_secret.yml b/roles/gitea/tasks/oauth2_jwt_secret.yml index d818584..6a2b028 100644 --- a/roles/gitea/tasks/oauth2_jwt_secret.yml +++ b/roles/gitea/tasks/oauth2_jwt_secret.yml @@ -25,8 +25,8 @@ ansible.builtin.file: path: /etc/gitea/oauth2_jwt_secret mode: "0600" - owner: "gitea" - group: "gitea" + owner: gitea + group: gitea - name: Create dictionary to hold oauth_jwt_secret uri ansible.builtin.set_fact: diff --git a/roles/gitea/tasks/secret_key.yml b/roles/gitea/tasks/secret_key.yml index 9f3a7d8..c17f185 100644 --- a/roles/gitea/tasks/secret_key.yml +++ b/roles/gitea/tasks/secret_key.yml @@ -25,8 +25,8 @@ ansible.builtin.file: path: /etc/gitea/secret_key mode: "0600" - owner: "gitea" - group: "gitea" + owner: gitea + group: gitea - name: Create dictionary to hold secret_key uri ansible.builtin.set_fact: diff --git a/roles/gitea/vars/main.yml b/roles/gitea/vars/main.yml index b473a40..172ab83 100644 --- a/roles/gitea/vars/main.yml +++ b/roles/gitea/vars/main.yml @@ -1,10 +1,10 @@ --- gitea_go_arch_map: - i386: '386' - x86_64: 'amd64' - aarch64: 'arm64' - armv7l: 'arm-6' - armv6l: 'arm-6' - armv5l: 'arm-5' + i386: "386" + x86_64: amd64 + aarch64: arm64 + armv7l: arm-6 + armv6l: arm-6 + armv5l: arm-5 gitea_arch: "{{ gitea_go_arch_map[ansible_architecture] | default(ansible_architecture) }}"