idealista / nginx_role

Ansible role to install nginx http and reverse proxy server
7 stars 2 forks source link

[BUG] Old server files does not get deleted #111

Closed xtianae7 closed 2 years ago

xtianae7 commented 2 years ago

Description

Old server configuration files are not being removed.

Steps to Reproduce

  1. Have an instance with multiple nginx servers running.
  2. Execute the playbook removing one of the servers from your templates or files directory.
  3. The removed server does not get removed.

Expected behavior: [What you expect to happen] Old servers removed after execution.

Actual behavior: [What actually happens] Old server does not get removed.

Reproduces how often: [What percentage of the time does it reproduce?] Always

Environment

Additional Information

[Any additional information, configuration or data that might be necessary to reproduce the issue.]

These lines should be removing the old servers https://github.com/idealista/nginx_role/blob/1bbab41ba130d78207bd36ef40693399982bdb3b/tasks/config.yml#L122-L150

Output of verbose mode of one of the tasks to remove servers:

TASK [nginx_role : NGINX | Remove old servers available] ***********************
ok: [nginxtest] => (item=['web3', 'web2-ssl']) => {
    "ansible_loop_var": "item",
    "changed": false,
    "invocation": {
        "module_args": {
            "_diff_peek": null,
            "_original_basename": null,
            "access_time": null,
            "access_time_format": "%Y%m%d%H%M.%S",
            "attributes": null,
            "follow": true,
            "force": false,
            "group": null,
            "mode": null,
            "modification_time": null,
            "modification_time_format": "%Y%m%d%H%M.%S",
            "owner": null,
            "path": "/etc/nginx/sites-available/['web3', 'web2-ssl']",
            "recurse": false,
            "selevel": null,
            "serole": null,
            "setype": null,
            "seuser": null,
            "src": null,
            "state": "absent",
            "unsafe_writes": false
        }
    },
    "item": [
        "web3",
        "web2-ssl"
    ],
    "path": "/etc/nginx/sites-available/['web3', 'web2-ssl']",
    "state": "absent"
}

We can see that the task tries to remove ['web3', 'web2-ssl'] as a whole, this does not work as ansible identifies it as a String, trying to remove ['web3', 'web2-ssl] as if its a single file named that way.

xtianae7 commented 2 years ago

Resolved with release 4.2.1