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

consul cluster forme failed #487

Open
charnet1019 opened this issue Jul 12, 2022 · 3 comments
Open

consul cluster forme failed #487

charnet1019 opened this issue Jul 12, 2022 · 3 comments

Comments

@charnet1019
Copy link

ansible version: 2.12.6

inventory:

[consul_instances]
consul1 consul_node_role=bootstrap
consul2 consul_node_role=server
consul3 consul_node_role=server
consul4 consul_node_role=client

playbook

---
- hosts: consul_instances
  gather_facts: yes

  roles:
    - role: consul
      vars:
        consul_version: 1.12.2
        consul_datacenter: dc1
        consul_addresses_http: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}"
        consul_acl_enable: true
        consul_connect_enabled: true
        consul_install_upgrade: true
        consul_data_path: "/data/consul/data"
  tags:
    - consul

Error Info

TASK [consul : Generate ACL master token] **************************************************************************************************************************************************
task path: /home/ansible/roles/consul/tasks/acl.yml:36
skipping: [consul1] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

TASK [consul : debug %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% bootstrap_state] ***********************************************************************************************************
task path: /home/ansible/roles/consul/tasks/acl.yml:42
skipping: [consul1] => {}
ok: [consul2] => {
    "bootstrap_state": {
        "changed": false,
        "failed": false,
        "stat": {
            "exists": false
        }
    }
}
skipping: [consul4] => {}
ok: [consul3] => {
    "bootstrap_state": {
        "changed": false,
        "failed": false,
        "stat": {
            "exists": false
        }
    }
}

TASK [consul : debug %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% consul_acl_master_token_keygen] ********************************************************************************************
task path: /home/ansible/roles/consul/tasks/acl.yml:46
skipping: [consul1] => {}
skipping: [consul4] => {}
ok: [consul2] => {
    "consul_acl_master_token_keygen": {
        "changed": false,
        "skip_reason": "Conditional result was False",
        "skipped": true
    }
}
ok: [consul3] => {
    "consul_acl_master_token_keygen": {
        "changed": false,
        "skip_reason": "Conditional result was False",
        "skipped": true
    }
}

TASK [consul : Save ACL master token] ******************************************************************************************************************************************************
task path: /home/ansible/roles/consul/tasks/acl.yml:50
skipping: [consul1] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}
fatal: [consul2]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/home/ansible/roles/consul/tasks/acl.yml': line 50, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Save ACL master token\n      ^ here\n"
}
fatal: [consul3]: FAILED! => {
    "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'stdout'\n\nThe error appears to be in '/home/ansible/roles/consul/tasks/acl.yml': line 50, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n\n    - name: Save ACL master token\n      ^ here\n"
}
skipping: [consul4] => {
    "changed": false,
    "skip_reason": "Conditional result was False"
}

Use the following configuration to create successfully with the same playbook.
inventory

consul1 consul_node_role=server consul_bootstrap_expect=true
consul2 consul_node_role=server consul_bootstrap_expect=true
consul3 consul_node_role=server consul_bootstrap_expect=true
consul4 consul_node_role=client
@dsegoviat
Copy link

I'm experiencing the same issue

@yusufbogatepe
Copy link

yusufbogatepe commented Dec 7, 2022

I'm experiencing the same problem. When i changed bootstrapped server to the last server on my inventory It resolved. The problem is run_once parameter. When the first host is bootstrapped in the inventory file, it skipped and run_once never let the acl token generation to the next server.

@guillaumesmo
Copy link

seems related to #593

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

4 participants