Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cisco.ios.ios_service does not disable services #1140

Open
jiholland opened this issue Nov 28, 2024 · 0 comments
Open

cisco.ios.ios_service does not disable services #1140

jiholland opened this issue Nov 28, 2024 · 0 comments

Comments

@jiholland
Copy link

SUMMARY

The cisco.ios.ios_service resource module does not disable services that has the enable parameter in a dictionary.

ISSUE TYPE
  • Bug Report
COMPONENT NAME

cisco.ios.ios_service

ANSIBLE VERSION
ansible [core 2.18.0]
  config file = /home/jiholland/ansible.cfg
  configured module search path = ['/home/jiholland/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/jiholland/.venv/lib/python3.12/site-packages/ansible
  ansible collection location = /home/jiholland/collections:/home/jiholland/.ansible/collections
  executable location = /home/jiholland/.venv/bin/ansible
  python version = 3.12.7 (main, Oct  7 2024, 08:37:53) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/home/jiholland/.venv/bin/python3)
  jinja version = 3.1.4
  libyaml = True
COLLECTION VERSION
Collection Version
---------- -------
cisco.ios  9.0.3
CONFIGURATION
ANSIBLE_COW_SELECTION(/home/jiholland/ansible-playbooks/ansible.cfg) = small
CALLBACKS_ENABLED(/home/jiholland/ansible-playbooks/ansible.cfg) = ['community.general.log_plays']
CONFIG_FILE() = /home/jiholland/ansible-playbooks/ansible.cfg
DEFAULT_FORKS(/home/jiholland/ansible-playbooks/ansible.cfg) = 20
DISPLAY_SKIPPED_HOSTS(/home/jiholland/ansible-playbooks/ansible.cfg) = False
HOST_KEY_CHECKING(/home/jiholland/ansible-playbooks/ansible.cfg) = False
OS / ENVIRONMENT
Switch Ports Model              SW Version        SW Image              Mode   
------ ----- -----              ----------        ----------            ----   
*    1 65    C9300-48T          17.12.04          CAT9K_IOSXE           INSTALL
*    1 12    WS-C2960CX-8TC-L   15.2(7)E10        C2960CX-UNIVERSALK9-M 
STEPS TO REPRODUCE

Execute the provided example playbook on a Catalyst device.

---
- name: Disable services.
  gather_facts: false
  hosts: dev-campus-leaf-1

  tasks:

    - name: Disable services.
      cisco.ios.ios_service:
        config:
          tcp_small_servers:
            enable: false
          udp_small_servers:
            enable: false
          timestamps:
            - msg: log
              enable: false
            - msg: debug
              enable: false
        state: merged
EXPECTED RESULTS

I expect the services to be disabled:

  • no service tcp-small-servers
  • no service udp-small-servers
  • no service timestamps log
  • no service timestamps debug
ACTUAL RESULTS

It enables the services instead of disabling them and for udp-small-servers nothing happens.

# Before running playbook:
dev-campus-leaf-1#show run | inc service
service timestamps debug uptime
service timestamps log uptime
service udp-small-servers
service tcp-small-servers

# After running playbook:
dev-campus-leaf-1#show run | inc service
service timestamps debug uptime
service timestamps log uptime
service udp-small-servers
service tcp-small-servers

# Commands executed on the device by playbook:
  974    46       jiholland@vty1     |service tcp-small-servers
  975    46       jiholland@vty1     |service timestamps debug uptime
  976    46       jiholland@vty1     |service timestamps log uptime
changed: [dev-campus-leaf-1] => {
    "after": {
        "counters": 0,
        "dhcp": true,
        "password_encryption": true,
        "password_recovery": true,
        "prompt": true,
        "slave_log": true,
        "tcp_keepalives_in": true,
        "tcp_keepalives_out": true,
        "tcp_small_servers": {
            "enable": true
        },
        "timestamps": [
            {
                "msg": "debug",
                "timestamp": "uptime"
            },
            {
                "msg": "log",
                "timestamp": "uptime"
            }
        ],
        "udp_small_servers": {
            "enable": true
        },
        "unsupported_transceiver": true
    },
    "before": {
        "counters": 0,
        "dhcp": true,
        "password_encryption": true,
        "password_recovery": true,
        "prompt": true,
        "slave_log": true,
        "tcp_keepalives_in": true,
        "tcp_keepalives_out": true,
        "tcp_small_servers": {
            "enable": true
        },
        "timestamps": [
            {
                "msg": "debug",
                "timestamp": "uptime"
            },
            {
                "msg": "log",
                "timestamp": "uptime"
            }
        ],
        "udp_small_servers": {
            "enable": true
        },
        "unsupported_transceiver": true
    },
    "changed": true,
    "commands": [
        "service tcp-small-servers",
        "service timestamps debug uptime",
        "service timestamps log uptime"
    ],
    "invocation": {
        "module_args": {
            "config": {
                "call_home": null,
                "compress_config": null,
                "config": null,
                "counters": 0,
                "dhcp": true,
                "disable_ip_fast_frag": null,
                "exec_callback": null,
                "exec_wait": null,
                "hide_telnet_addresses": null,
                "internal": null,
                "linenumber": null,
                "log": null,
                "log_hidden": null,
                "nagle": null,
                "old_slip_prompts": null,
                "pad": null,
                "pad_cmns": null,
                "pad_from_xot": null,
                "pad_to_xot": null,
                "password_encryption": null,
                "password_recovery": true,
                "private_config_encryption": null,
                "prompt": true,
                "pt_vty_logging": null,
                "scripting": null,
                "sequence_numbers": null,
                "slave_coredump": null,
                "slave_log": true,
                "tcp_keepalives_in": null,
                "tcp_keepalives_out": null,
                "tcp_small_servers": {
                    "enable": false,
                    "max_servers": null,
                    "no_limit": null
                },
                "telnet_zeroidle": null,
                "timestamps": [
                    {
                        "datetime_options": null,
                        "enable": false,
                        "msg": "log",
                        "timestamp": null
                    },
                    {
                        "datetime_options": null,
                        "enable": false,
                        "msg": "debug",
                        "timestamp": null
                    }
                ],
                "udp_small_servers": {
                    "enable": false,
                    "max_servers": null,
                    "no_limit": null
                },
                "unsupported_transceiver": null
            },
            "running_config": null,
            "state": "merged"
        }
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant