Feature users config ssh #9 #10

Merged
srgvg merged 10 commits from feature-users-config-ssh-#9 into master 2018-09-02 06:45:47 +00:00
srgvg commented 2018-08-19 19:13:53 +00:00 (Migrated from github.com)

This is so far we got with your request. This one was somehow a bit more subjective, so we're not so sure this is exactly what you requested.
Please review this and let us know what you think.
Thanks, Serge & Vincent.

This is so far we got with your request. This one was somehow a bit more subjective, so we're not so sure this is exactly what you requested. Please review this and let us know what you think. Thanks, Serge & Vincent.
reelsense commented 2018-08-20 18:54:51 +00:00 (Migrated from github.com)

I'm looking through the documentation you guys produced. I haven't even tested it yet, but I'm really excited. 😛

I'm looking through the documentation you guys produced. I haven't even tested it yet, but I'm really excited. 😛
reelsense (Migrated from github.com) requested changes 2018-08-23 22:02:10 +00:00
reelsense (Migrated from github.com) left a comment

This PR is fantastic. Despite the subjectivity of this project you did everything exactly how I wanted. I really appreciate how well you guys read my mind. Every time I thought I had a question, I thought "I should see if they explain this is the documentation before I ask them..." sure enough, the doc had the answer or referenced the solution.

I'm really grateful.

I posted an update on the original issue with a change. https://github.com/stationgroup/ansible-experiments/issues/9#issuecomment-415582205

As well as some question in the form of code comments; which can be seen in the PR: https://github.com/stationgroup/ansible-experiments/pull/10

>This PR is fantastic. Despite the subjectivity of this project you did everything exactly how I wanted. I really appreciate how well you guys read my mind. Every time I thought I had a question, I thought _"I should see if they explain this is the documentation before I ask them..."_ sure enough, the doc had the answer or referenced the solution. > >I'm really grateful. I posted an update on the original issue with a change. https://github.com/stationgroup/ansible-experiments/issues/9#issuecomment-415582205 As well as some question in the form of code comments; which can be seen in the PR: https://github.com/stationgroup/ansible-experiments/pull/10
reelsense (Migrated from github.com) commented 2018-08-20 23:36:07 +00:00

TASK [users : Ensure .ssh folder is created] fails if user is set to absent after it was previously present.

  (Click to expand code)
TASK [users : Ensure .ssh folder is created] *******************************************************
failed: [127.0.0.1] (item={u'bash_lines': [{u'line': u'testline', u'state': u'present'}, {u'line': u'export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh', u'state': u'present'}, {u'line': u"alias ls='ls lah'", u'state': u'present'}], u'name': u'remember', u'keys': [{u'state': u'present', u'file': u'key1'}], u'ssh_config': [{u'ServerAliveInterval': 10}], u'state': u'absent', u'groups': [u'mygroup'], u'uid': 1100}) => {
    "changed": false, 
    "gid": 1100, 
    "group": "1100", 
    "item": {
        "bash_lines": [
            {
                "line": "testline", 
                "state": "present"
            }, 
            {
                "line": "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh", 
                "state": "present"
            }, 
            {
                "line": "alias ls='ls lah'", 
                "state": "present"
            }
        ], 
        "groups": [
            "mygroup"
        ], 
        "keys": [
            {
                "file": "key1", 
                "state": "present"
            }
        ], 
        "name": "remember", 
        "ssh_config": [
            {
                "ServerAliveInterval": 10
            }
        ], 
        "state": "absent", 
        "uid": 1100
    }, 
    "mode": "0700", 
    "owner": "1100", 
    "path": "/home/remember/.ssh", 
    "size": 4096, 
    "state": "directory", 
    "uid": 1100
}

MSG:

chown failed: failed to look up user remember

ok: [127.0.0.1] => (item={u'keys': [{u'state': u'absent', u'file': u'key2'}], u'name': u'test', u'csh_lines': [{u'line': u'alias ls ls -lah', u'state': u'present'}]})

PLAY RECAP *****************************************************************************************
127.0.0.1                  : ok=8    changed=1    unreachable=0    failed=1   
`TASK [users : Ensure .ssh folder is created]` fails if user is set to `absent` after it was previously `present`. <details>   <summary>(Click to expand code)</summary> ```yaml TASK [users : Ensure .ssh folder is created] ******************************************************* failed: [127.0.0.1] (item={u'bash_lines': [{u'line': u'testline', u'state': u'present'}, {u'line': u'export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh', u'state': u'present'}, {u'line': u"alias ls='ls lah'", u'state': u'present'}], u'name': u'remember', u'keys': [{u'state': u'present', u'file': u'key1'}], u'ssh_config': [{u'ServerAliveInterval': 10}], u'state': u'absent', u'groups': [u'mygroup'], u'uid': 1100}) => { "changed": false, "gid": 1100, "group": "1100", "item": { "bash_lines": [ { "line": "testline", "state": "present" }, { "line": "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh", "state": "present" }, { "line": "alias ls='ls lah'", "state": "present" } ], "groups": [ "mygroup" ], "keys": [ { "file": "key1", "state": "present" } ], "name": "remember", "ssh_config": [ { "ServerAliveInterval": 10 } ], "state": "absent", "uid": 1100 }, "mode": "0700", "owner": "1100", "path": "/home/remember/.ssh", "size": 4096, "state": "directory", "uid": 1100 } MSG: chown failed: failed to look up user remember ok: [127.0.0.1] => (item={u'keys': [{u'state': u'absent', u'file': u'key2'}], u'name': u'test', u'csh_lines': [{u'line': u'alias ls ls -lah', u'state': u'present'}]}) PLAY RECAP ***************************************************************************************** 127.0.0.1 : ok=8 changed=1 unreachable=0 failed=1 ``` </details>
reelsense (Migrated from github.com) commented 2018-08-20 23:48:26 +00:00

I guess the procedure I should use is. When a user is removed. Remove their variables so the script continues to function. Because the variables try to set because the home folder exists even though the user is gone.

I guess the procedure I should use is. When a user is removed. Remove their variables so the script continues to function. Because the variables try to set because the home folder exists even though the user is gone.
reelsense (Migrated from github.com) commented 2018-08-23 21:21:05 +00:00

If I add a user to a group: admin. I can't remove the user from a group. Please advise if there is a method I've over looked.

If I add a user to a group: `admin`. I can't remove the user from a group. **Please advise** if there is a method I've over looked.
reelsense (Migrated from github.com) commented 2018-08-23 21:23:33 +00:00

I can add but not remove, multiline bash entries.

users:
  - name: remember
    state: present
    groups:
      - mygroup
    uid: 1100
    keys:
      - file: key1
        state: present
    bash_lines:
      - line: "testline"
        state: absent
      - line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
        state: present
      - line: "alias ls='ls -lah'"
        state: present
      - line: |
         #this is a testline
         #this is a testline2         
        state: absent
    ssh_config:
      - ServerAliveInterval: 10
I can add but not remove, multiline bash entries. ```yaml users: - name: remember state: present groups: - mygroup uid: 1100 keys: - file: key1 state: present bash_lines: - line: "testline" state: absent - line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh" state: present - line: "alias ls='ls -lah'" state: present - line: | #this is a testline #this is a testline2 state: absent ssh_config: - ServerAliveInterval: 10 ```
reelsense (Migrated from github.com) commented 2018-08-23 21:27:43 +00:00

Please advise.

**Please advise**.
vincentvdk (Migrated from github.com) reviewed 2018-08-26 11:50:56 +00:00
vincentvdk (Migrated from github.com) commented 2018-08-26 11:50:56 +00:00

We'll have to make the 'users.state' variable required. I'll make the necessary changes to the tasks and check for required variables at runtime.

We'll have to make the 'users.state' variable required. I'll make the necessary changes to the tasks and check for required variables at runtime.
vincentvdk (Migrated from github.com) reviewed 2018-08-26 13:15:17 +00:00
vincentvdk (Migrated from github.com) commented 2018-08-26 13:15:17 +00:00

the 'user' module ws using the 'append' option. This will be removed

the 'user' module ws using the 'append' option. This will be removed
vincentvdk (Migrated from github.com) reviewed 2018-08-26 13:16:01 +00:00
vincentvdk (Migrated from github.com) commented 2018-08-26 13:16:01 +00:00

I updated the playbooks to add a task for multi line content leveraging the 'blockinfile' module.

I updated the playbooks to add a task for multi line content leveraging the 'blockinfile' module.
vincentvdk (Migrated from github.com) reviewed 2018-08-26 13:16:49 +00:00
vincentvdk (Migrated from github.com) commented 2018-08-26 13:16:49 +00:00

I made the necessary changes and commited everything to @srgvg his repository so he can make a proper PR here.

I made the necessary changes and commited everything to @srgvg his repository so he can make a proper PR here.
srgvg commented 2018-08-30 08:23:20 +00:00 (Migrated from github.com)

I added @vincentvdk's most recent commit addressing the requested changes, 59749462c0 to this PR.

I added @vincentvdk's most recent commit addressing the requested changes, https://github.com/stationgroup/ansible-experiments/pull/10/commits/59749462c0eb66f9dc53744d8e45fffcbd202a5e to this PR.
reelsense commented 2018-08-30 19:01:06 +00:00 (Migrated from github.com)

Thank you.

I'll try to test it this weekend. If I cant test it this weekend I'll probably be to busy to test for a while, and I'll just have you bill me. I don't want to make you wait too much longer.

Thank you. I'll try to test it this weekend. If I cant test it this weekend I'll probably be to busy to test for a while, and I'll just have you bill me. I don't want to make you wait too much longer.
reelsense (Migrated from github.com) reviewed 2018-08-30 19:07:55 +00:00
@ -0,0 +82,4 @@
when: ansible_os_family == "Debian"
- name: Ensure sudo is installed (FreeBSD)
portinstall:
reelsense (Migrated from github.com) commented 2018-08-30 19:07:55 +00:00

I'm going to try this with pkgng I don't like to mix ports in with my pkg's if I can avoid it.

I'm going to try this with [`pkgng`](https://docs.ansible.com/ansible/2.6/modules/pkgng_module.html?highlight=pkg) I don't like to mix _ports_ in with my _pkg's_ if I can avoid it.
reelsense (Migrated from github.com) approved these changes 2018-09-01 01:05:36 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: stationgroup/ansible-experiments#10
No description provided.