ContainerSolutions / dcos-ansible-packet

Ansible playbook for installing DC/OS on Packet cloud
4 stars 3 forks source link

Document how to properly add a new agent #39

Open nervetattoo opened 6 years ago

nervetattoo commented 6 years ago

I managed to add a new node by removing the common tag from firewall tasks and then using the playbook like this:

  1. ansible-playbook -i playground.inventory playbook.yml -l agent-4 -t common
  2. ansible-playbook -i playground.inventory playbook.yml -l bootstrap,agent-4 -t install-agent
  3. ansible-playbook -i playground.inventory playbook.yml -t firewall

I assume the playbook can simply be run and you would get a new node after adding it to inventory, but I was unsure about any side effects of re-running it for existing nodes? My recipe should be side-effect free, but its cumbersome and requires some changes to tags in tasks that might break something you had originally thought about?

frankscholten commented 6 years ago

Good point. Another design would be to create a separate playbook for adding an agent that reuses the code from the roles. Is that possible?

nervetattoo commented 6 years ago

My ansible knowledge is very limited so I don't know. But judging from the current playbook it feels like it should be possible with the roles as long the roles don't have the interdependency they currently have (which is why I had to specify bootstrap in -l, to get the ip of the bootstrap server). Also, if you deleted the bootstrap node, you need to reconstruct it to add a new agent.

frankscholten commented 6 years ago

Perhaps we can use delegate_facts? It seems we can then limit the playbook to the agent and delegate facts to bootstrap. http://docs.ansible.com/ansible/latest/playbooks_delegation.html#delegated-facts

Any other concrete things how we can refactor the code to get rid of the tangling of the roles?