diff --git a/.github/workflows/libvirt.yml b/.github/workflows/libvirt.yml index f097350..99fe122 100644 --- a/.github/workflows/libvirt.yml +++ b/.github/workflows/libvirt.yml @@ -12,9 +12,30 @@ on: - '.github/workflows/libvirt.yml' jobs: + version: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Check if galaxy.yml has been modified + run: | + # Get a list of all modified files in this PR + FILES_CHANGED=$(git diff --name-only HEAD^ HEAD) + echo "Files changed: $FILES_CHANGED" + + # Check if galaxy.yml is in the list of changed files + if [[ $FILES_CHANGED != *"galaxy.yml"* ]]; then + echo "Error: galaxy.yml has not been modified." + exit 1 + fi + libvirt: name: libvirt runs-on: libvirt + needs: version strategy: matrix: scenario: diff --git a/.github/workflows/version.yml b/.github/workflows/version.yml index 29bcade..68287ce 100644 --- a/.github/workflows/version.yml +++ b/.github/workflows/version.yml @@ -1,5 +1,6 @@ --- name: version + on: pull_request: branches: @@ -8,7 +9,6 @@ on: jobs: version: runs-on: ubuntu-latest - steps: - name: Checkout repository uses: actions/checkout@v4 diff --git a/galaxy.yml b/galaxy.yml index 9088796..a79c99d 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -1,7 +1,7 @@ --- namespace: nephelaiio name: mongodb -version: 0.2.11 +version: 0.2.12 readme: README.md authors: - Ted Cook diff --git a/playbooks/config.yml b/playbooks/config.yml index 7b405cf..9774549 100644 --- a/playbooks/config.yml +++ b/playbooks/config.yml @@ -4,19 +4,6 @@ vars_files: - main.yml tasks: - - name: Gather service facts - ansible.builtin.service_facts: - - - name: Group provisioned hosts - ansible.builtin.group_by: - key: "mongodb_config_{{ _status }}" - vars: - _service: "{{ _mongodb_service_name }}.service" - _deployed: "{{ _service in services }}" - _stopped: "{{ _deployed and services[_service].state != 'running' }}" - _inactive: "{{ (not _deployed) or _stopped }}" - _status: "{{ 'install' if _inactive else 'update' }}" - - name: Set replicaset facts ansible.builtin.set_fact: mongodb_replicaset_members: "{{ _mongodb_members | map(_filter, '%s:' + _mongodb_port) | list }}" @@ -29,19 +16,8 @@ _mongodb_members: "{{ _mongodb_hosts if _mongodb_hosts_manage else _mongodb_addrs }}" -- name: Deploy new config replicaset members - hosts: mongodb_config_install - become: true - vars_files: - - main.yml - roles: - - nephelaiio.mongodb.repo - - nephelaiio.mongodb.mongodb - - -- name: Update existing config replicaset members - hosts: mongodb_config_update - serial: 1 +- name: Deploy config replicaset members + hosts: "{{ __mongodb_config }}" become: true vars_files: - main.yml diff --git a/playbooks/shard.yml b/playbooks/shard.yml index 6b84402..dfd6f19 100644 --- a/playbooks/shard.yml +++ b/playbooks/shard.yml @@ -1,22 +1,9 @@ --- - name: Query shard replicaset member status - hosts: "{{ mongodb_shard | default('mongodb_shard') }}" + hosts: "{{ mongodb_shard }}" vars_files: - main.yml tasks: - - name: Gather service facts - ansible.builtin.service_facts: - - - name: Group provisioned hosts - ansible.builtin.group_by: - key: "mongodb_shard_{{ _status }}" - vars: - _service: "{{ _mongodb_service_name }}.service" - _deployed: "{{ _service in services }}" - _stopped: "{{ _deployed and services[_service].state != 'running' }}" - _inactive: "{{ (not _deployed) or _stopped }}" - _status: "{{ 'install' if _inactive else 'update' }}" - - name: Set replicaset facts ansible.builtin.set_fact: mongodb_replicaset_members: "{{ _mongodb_members | map(_filter, '%s:' + _mongodb_port) | list }}" @@ -24,24 +11,13 @@ mongodb_sharding_role: shardsvr vars: _filter: "nephelaiio.plugins.map_format" - _mongodb_hosts: "{{ groups[mongodb_shard | default('mongodb_shard')] }}" + _mongodb_hosts: "{{ groups[mongodb_shard] }}" _mongodb_addrs: "{{ _mongodb_hosts | map('extract', hostvars, __mongodb_address_attrs) | list }}" _mongodb_members: "{{ _mongodb_hosts if _mongodb_hosts_manage else _mongodb_addrs }}" -- name: Deploy new shard replicaset members - hosts: mongodb_shard_install - become: true - vars_files: - - main.yml - roles: - - nephelaiio.mongodb.repo - - nephelaiio.mongodb.mongodb - - -- name: Update existing shard replicaset members - hosts: mongodb_shard_update - serial: 1 +- name: Deploy shard replicaset members + hosts: "{{ mongodb_shard }}" become: true vars_files: - main.yml diff --git a/roles.yml b/roles.yml index 7350957..3084c64 100644 --- a/roles.yml +++ b/roles.yml @@ -12,7 +12,7 @@ roles: scm: git - name: mongodb src: https://github.com/wpnops/ansible-role-mongodb.git - version: 0.1.25 + version: 0.1.27 scm: git - name: update src: https://github.com/robertdebock/ansible-role-update.git