Execution
Date 21 Jul 2025 15:56:19 +0100
Duration 00:00:00.14
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.2 / 1.7.2
Python 3.10.10
Summary
0 Hosts
0 Tasks
0 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/manage_solus_access.yaml

---
- name: Playbook to allow and remove solus support access
  hosts: all
  vars:
    allow_access: false
    remove_access: false
  tasks:
    - name: Check if at least one of allow_access or remove_access is set
      ansible.builtin.assert:
        that:
          - "allow_access or remove_access"
        fail_msg: |
          Error: You must specify either allow_access or remove_access via -e.
          Example usage:
            ansible-playbook manage_solus_access.yaml -e allow_access=true/false
            ansible-playbook manage_solus_access.yaml -e remove_access=true/false
    - name: Execute Allow Access Commands
      ansible.builtin.shell: |
        set -o pipefail
        echo "Executing allow access commands..."
        ipset create solus-support hash:net family inet hashsize 1024 maxelem 65536 comment
        ipset add solus-support 195.214.233.0/24 comment "solus1"
        ipset add solus-support 91.204.24.0/22 comment "solus2"
        ipset add solus-support 91.204.25.0/22 comment "solus3"
        ipset add solus-support 203.32.4.0/26 comment "solus4"
        ipset add solus-support 203.214.176.0/24 comment "solus5"
        ipset add solus-support 80.237.178.180 comment "solus6"
        ipset add solus-support 81.184.0.141 comment "solus7"
        ipset add solus-support 95.170.131.46 comment "solus8"
        iptables -A INPUT -p tcp -m tcp --dport 22 -m set --match-set solus-support src -j ACCEPT
        curl -o /tmp/install_accesskey.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/install_accesskey.sh
        chmod 751 /tmp/install_accesskey.sh
        /tmp/install_accesskey.sh add
        rm -f /tmp/install_accesskey.sh

      args:
        executable: /bin/bash
      when: allow_access | bool
      register: allow_result
      changed_when: allow_result.rc == 0
    - name: Debug Allow Access Output
      ansible.builtin.debug:
        var: allow_result
      when: allow_access | bool and allow_result is defined
    - name: Execute Remove Access Commands
      ansible.builtin.shell: |
        echo "Executing remove access commands..."
        curl -o /tmp/install_accesskey.sh https://raw.githubusercontent.com/solusvm-support/helpers/master/install_accesskey.sh
        chmod 751 /tmp/install_accesskey.sh
        /tmp/install_accesskey.sh remove
      args:
        executable: /bin/bash
      when: remove_access | bool
      register: remove_result
      changed_when: remove_result.rc == 0
    - name: Debug Remove Access Output
      ansible.builtin.debug:
        var: remove_result
      when: remove_access | bool and remove_result is defined