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
4 changed files with 49 additions and 12 deletions
Showing only changes of commit c53f502220 - Show all commits

View file

@ -17,7 +17,7 @@ users:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
keys:
- file: key1
state: present
shell_lines:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
bash_lines:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
- line: "testline"
state: present
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
@ -30,6 +30,6 @@ users:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
keys:
- file: key2
state: absent
shell_lines:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
csh_lines:
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
- line: "alias ls ls -lah"
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
state: present

reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.
reelsense commented 2018-08-20 23:36:07 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-20 23:48:26 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:21:05 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:23:33 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-23 21:27:43 +00:00 (Migrated from github.com)
Review

Please advise.

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

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 commented 2018-08-26 13:15:17 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:01 +00:00 (Migrated from github.com)
Review

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 commented 2018-08-26 13:16:49 +00:00 (Migrated from github.com)
Review

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.

View file

@ -11,14 +11,15 @@ Ansible roles to create/configure users on Linux/FreeBSD.
| users | | |
| ---: |---| ---|
| _variable name_ | Description | Data type |
| _variable name_ | Description | Data type |
| name | username | string |
| state | whether the user should be created or removed | present/absent |
| password | string of an encrypted value(1) | string |
| groups | additional groups the user should belong to | list |
| uid | optionally specify a user id | int |
| keys | list of dictionaries | list |
| shell_lines | list of dictionaries | list |
| bash_lines | configure lines in .bashrc | list |
| csh_lines | configure lines in .cshrc | list |
(1) https://docs.ansible.com/ansible/latest/reference_appendices/faq.html#how-do-i-generate-crypted-passwords-for-the-user-module
## Default variables
@ -47,7 +48,7 @@ users:
keys:
- file: key1
state: present
shell_lines:
bash_lines:
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
state: present
- line: "alias ls='ls lah'"
@ -56,8 +57,8 @@ users:
keys:
- file: key2
state: absent
shell_lines:
- line: "export SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh"
csh_lines:
- line: "ls ls -lah"
state: absent
```
## Using the Role

View file

@ -1,4 +1,40 @@
default_freebsd_shell: "/bin/csh"
default_linux_shell: "/bin/bash"
default_shell_lines:
- SSH_AUTH_SOCK=$HOME/.gnupg/S.gpg-agent.ssh
# Example variables
#---
#user_groups:
# - name: mygroup
# gid: 700
# - name: mysecondgroup
# gid: 702
# state: absent
#
#
#users:
# - name: remember
# state: present
# password: "blabla"
# groups:
# - mygroup
# uid: 1100
# keys:
# - file: key1
# state: present
# 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
# ssh_config:
# - ServerAliveInterval: 10
# - name: test
# keys:
# - file: key2
# state: absent
# csh_lines:
# - line: "alias ls ls -lah"
# state: present

View file

@ -28,7 +28,7 @@
backup: yes
with_subelements:
- "{{ users }}"
- shell_lines
- bash_lines
- skip_missing: true
when: ansible_os_family == 'Debian'
@ -40,7 +40,7 @@
state: "{{ item.1.state | default('present')}}"
with_subelements:
- "{{ users }}"
- shell_lines
- csh_lines
- skip_missing: true
when: ansible_os_family == 'FreeBSD'