# Could not match supplied host pattern, ignoring:

**URL:** <https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463>\
**Category:** Get Help\
**Created:** [September 12, 2024, 12:19pm UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463 "2024-09-12T12:19:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [September 12, 2024, 12:19pm UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463/1 "2024-09-12T12:19:02Z")

</div>

Hello!  
Id like to use fron anther project what functioned for a diffrent cause: move db from servers wih survey, bbut i get this message and tomehow the host gets the wrong ip from the dest var.

 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/c/cc37baf5cc5107c457ce4f6f4b0391016373f767.png)

my hosts i edited to just ip for debug:

 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/8/8ad36f4bc689ec2a1db350e9d5556725d7a42271.png)  
the Survey of the faulty host:  
 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/2/2f65347fe58e2aa4c37954a915c49f7481f8b10a.png)  
Workflow:  
 ![grafik](https://us1.discourse-cdn.com/ansible/original/2X/9/9b00739126b8f71110bf2f7122e44f7ddf30987e.png)

Log:

```auto
Enter passphrase for /runner/artifacts/6924/ssh_key_data: 
Identity added: /runner/artifacts/6924/ssh_key_data (/runner/artifacts/6924/ssh_key_data)
ansible-playbook [core 2.15.12]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.9.19 (main, Jul 18 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
No config file found; using defaults
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with script plugin
Skipping callback 'awx_display', as we already have a stdout callback.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: workflow_variables_checker.yaml **************************************
1 plays in functions/SQL/migration/workflow_variables_checker.yaml
[WARNING]: Could not match supplied host pattern, ignoring: 192.168.151.201

PLAY [Display and compare extra variables and fail if they match] **************

TASK [Display the value of 'sql_src_srv'] **************************************
task path: /runner/project/functions/SQL/migration/workflow_variables_checker.yaml:11
ok: [192.168.151.237] => {
    "msg": "The value of sql_src_srv is 192.168.151.237"
}

TASK [Display the value of 'sql_src_db'] ***************************************
task path: /runner/project/functions/SQL/migration/workflow_variables_checker.yaml:15
ok: [192.168.151.237] => {
    "msg": "The value of sql_src_db is sakila"
}

TASK [Display the value of 'sql_dest_srv'] *************************************
task path: /runner/project/functions/SQL/migration/workflow_variables_checker.yaml:19
ok: [192.168.151.237] => {
    "msg": "The value of sql_dest_srv is 192.168.151.201"
}

TASK [Check if 'sql_src_srv' and 'sql_dest_srv' have the same content and fail if true] ***
task path: /runner/project/functions/SQL/migration/workflow_variables_checker.yaml:23
skipping: [192.168.151.237] => {
    "changed": false,
    "false_condition": "sql_src_srv == sql_dest_srv",
    "skip_reason": "Conditional result was False"
}

```

Somehow the vars get correct set , but hte host sqldest srv gets an random ip in the next playbook of the workflow right at the beginning without any reason:

```auto
Enter passphrase for /runner/artifacts/6933/ssh_key_data: 
Identity added: /runner/artifacts/6933/ssh_key_data (/runner/artifacts/6933/ssh_key_data)
ansible-playbook [core 2.15.12]
  config file = None
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/lib/python3.9/site-packages/ansible
  ansible collection location = /runner/requirements_collections:/runner/.ansible/collections:/usr/share/ansible/collections
  executable location = /usr/local/bin/ansible-playbook
  python version = 3.9.19 (main, Jul 18 2024, 00:00:00) [GCC 11.4.1 20231218 (Red Hat 11.4.1-3)] (/usr/bin/python3)
  jinja version = 3.1.4
  libyaml = True
No config file found; using defaults
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Parsed /runner/inventory/hosts inventory source with script plugin
Skipping callback 'awx_display', as we already have a stdout callback.
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.

PLAYBOOK: install_pymysql_env_workflow-vars.yaml *******************************
1 plays in functions/SQL/migration/install_pymysql_env_workflow-vars.yaml

PLAY [install pymysql+ requirements+env] ***************************************

TASK [Ensure pip and venv are installed] ***************************************
task path: /runner/project/functions/SQL/migration/install_pymysql_env_workflow-vars.yaml:10
<192.168.151.150> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.151.150> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o StrictHostKeyChecking=no -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o 'User="root"' -o ConnectTimeout=10 -o 'ControlPath="/runner/cp/e3b87fbd70"' 192.168.151.150 '/bin/sh -c '"'"'echo ~root && sleep 0'"'"''
<192.168.151.237> ESTABLISH SSH CONNECTION FOR USER: root
<192.168.151.237> SSH: EXEC ssh -C -o ControlMaster=auto -o Contr

```

Thank you again!!

---

<div class="post-metadata">

**Author:** ![RayJin2000](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/rayjin2000/32/3641_2.png) [@RayJin2000](https://forum.ansible.com/u/RayJin2000)\
**Post date:** [September 13, 2024, 8:25am UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463/2 "2024-09-13T08:25:12Z")

</div>

It is hart to help you, with only this information.

`Could not match supplied host pattern` normally means that the host list in your playbook and the limit doesn’t match.

can you show us the `ansible-playbook` call and some of the Task definitions in your Playbook that doesn’t work correctly.

I’m also not sure how you pass the variables, maybe this will help you: [delegating-facts](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_delegation.html#delegating-facts)

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [September 13, 2024, 11:35am UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463/3 "2024-09-13T11:35:33Z")

</div>

okay,  
there are a few the first checks if sorce and dest is the same:

```auto
---
- name: Create temp MySQL user with full privileges
  hosts:
    - "{{ sql_dest_srv }}"  
    - "{{ sql_src_srv }}"   
  gather_facts: false  
  become: true
  vars:
    ansible_python_interpreter: /opt/myenv/bin/python3

  tasks:
    - name: Create MySQL user with necessary privileges
      community.mysql.mysql_user:
        name: "{{ sql_user }}"
        password: "{{ sql_passwd }}"
        login_unix_socket: /var/run/mysqld/mysqld.sock
        priv: '*.*:ALL,GRANT'
        host: '%'
        state: present

```

then install of pymysql and env as requirements for the rest:

```auto
---
- name: install pymysql+ requirements+env
  hosts: all
  gather_facts: false # Disabling fact gathering to speed up the playbook execution
  become: true
# vars:
# ansible_python_interpreter: /opt/myenv/bin/python3

  tasks:
    - name: Ensure pip and venv are installed
      ansible.builtin.apt:
        name: 
          - python3-pip
          - python3-venv
          - python3-dev
          - build-essential
          - libssl-dev
          - libffi-dev
          - libmysqlclient-dev
          - pkg-config
        state: present
      #become: yes

    - name: Create a virtual environment
      ansible.builtin.command:
        cmd: python3 -m venv /opt/myenv
      #become: yes
      args:
        creates: /opt/myenv

    - name: Install required Python packages in virtual environment
      ansible.builtin.pip:
        executable: /opt/myenv/bin/pip
        name:
          - pymysql
          #- mysqlclient
      #become: yes

```

then adding the sql migration user:

```auto
---
- name: Create temp MySQL user with full privileges
  hosts:
    - "{{ sql_dest_srv }}" # {{ sql_dest_srv }} 192.168.151.141
    - "{{ sql_src_srv }}" # {{ sql_src_srv }} 192.168.151.237
  gather_facts: false # Disabling fact gathering to speed up the playbook execution
  become: true
  vars:
    ansible_python_interpreter: /opt/myenv/bin/python3

  tasks:
    - name: Create MySQL user with necessary privileges
      community.mysql.mysql_user:
        name: "{{ sql_user }}"
        password: "{{ sql_passwd }}"
        login_unix_socket: /var/run/mysqld/mysqld.sock
        priv: '*.*:ALL,GRANT'
        host: '%'
        state: present

```

need more?  
the {{ sql\_src\_db }} {{ sql\_src\_srv }}{{ sql\_dest\_srv }} env get set in the survey the rest vie env credentials.

i got it running, but i accidently deleted the wokflow in the templates

---

<div class="post-metadata">

**Author:** ![gothsome](https://avatars.discourse-cdn.com/v4/letter/g/278dde/32.png) [@gothsome](https://forum.ansible.com/u/gothsome)\
**Post date:** [September 17, 2024, 1:24pm UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463/4 "2024-09-17T13:24:59Z")

</div>

I messed up myself- forgot to set the hosts to all playboooks he same and not just in the Workflow

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [October 17, 2024, 1:25pm UTC](https://forum.ansible.com/t/could-not-match-supplied-host-pattern-ignoring/8463/5 "2024-10-17T13:25:53Z")

</div>

Closed on October 17, 2024, 1:25pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
