Skip to content

Improve ensure_stack_user tasks#26

Open
danpawlik wants to merge 1 commit into
SeanMooney:masterfrom
danpawlik:improve-user
Open

Improve ensure_stack_user tasks#26
danpawlik wants to merge 1 commit into
SeanMooney:masterfrom
danpawlik:improve-user

Conversation

@danpawlik

Copy link
Copy Markdown

What's improved:

  • moved creating user dir to user module
  • setting authorized_keys does not use lookup module

@SeanMooney SeanMooney left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks reasonabel let me doubel check a few thing first

password: "{{ stack_user_password | password_hash('sha512','A512') }}"
shell: /bin/bash
group: stack
home: /opt/stack

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i was actully intentionlly not using /opt/stack as the home dire but we can. that is more aligned to devstacsk default behavior if you use its script

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree, but if you would like to have /home/{{ microshift_user }} in that case there would be another issue

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[stack@microshift ~]$ ls -al .kube/config
-rw-------. 1 stack stack 11431 Jun 9 05:29 .kube/config
[stack@microshift ~]$ echo $HOME
/home/stack
[stack@microshift ~]$ pwd
/home/stack
[stack@microshift ~]$ oc get pod | head -n 2
NAME READY STATUS RESTARTS AGE
bootstrap-edpm-deployment-openstack-edpm-zssvc 0/1 Completed 0 2d20h

so what your seeign dose not seam to macht up to what i saw in my microshfit env

how did you create teh vm out of interst

currentl that is form the oko microshfit molecule senario

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think i know why there may be a delta in behavior.

im using molecule for testign invoking the ansibel to providsion the vms which is using cloud-init to bootstrap the intiall vm before runnign the ansible.

if you created the vm or are tryign to run agaisnt a prexisting vm the user setup may be different.

https://github.com/SeanMooney/ard/blob/master/ansible/roles/ard_libvirt_node/tasks/node.yml#L38-L45

ill review the behvior with and without that and get back to you.

this role is how i used to do that when i was using molecule vagrant and the old way this repo works but i changed the user creation in the last week and have not confirm this role is still alinged to that on a prexisting vm or one when the cloud-init file is not used.

create: true
mode: "0440"
line: "{{ devstack_user }} ALL=(ALL) NOPASSWD:ALL"
validate: "visudo -cf %s"

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure that makes it configurable.

Comment thread ansible/roles/ensure_stack_user/tasks/main.yml Outdated
ansible.builtin.slurp:
src: .ssh/authorized_keys
register: _user_authorized_keys

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok so your doing this so that if you have preprovisioned a node we can extend the exsitng keys

i thoug we didnt need to do that when using ansible.posix.authorized_key and it would append.

im not agsint that but let me double check the docs

What's improved:
- moved creating user dir to user module
- setting authorized_keys does not use lookup module

Signed-off-by: Daniel Pawlik <pawlik.dan@gmail.com>
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

Successfully merging this pull request may close these issues.

2 participants