- Ansible Quick Start Guide
- Mohamed Alibi
- 251字
- 2021-07-23 16:37:48
The user management module
As suggested by its name, this module is for user management on a Linux system. As an example, we will make a playbook that creates a system user named install to be used later to manage the remote machine. The playbook script is as follows :
---
- name: Linux Module running
hosts: servers
become: yes
gather_facts: false
tasks:
- name: create a system user to be used by Ansible
user:
name: install
state: present
shell: /bin/bash
group: sudo
system: yes
hidden: yes
ssh_key_file: .ssh/id_rsa
expires: -1
You can always add -v or -vvv if you want extra output when running a playbook. The following screenshot shows the output of a normal run and one with the -v option:
The same module can also be used to remove the user, either by changing their state to absent or disabling them by changing their shell to /bin/nologin. For some clustered environments, some users shared by the systems must have the same UID to be able to run tasks via the jobs handlers. The uid option can allow a particular user to have a selection of specific UIDs when creating hosts, although this is not recommended.
The modules have many special return values, which can be collected for pipelining with other modules. The most useful modules are the following:
- home: Shows the home directory for the user
- ssh_public_key: Allows the key print to be put into a file for multiple purposes
- uid: Shows the UID of the newly created user
- 基于LabWindows/CVI的虛擬儀器設計與應用
- AWS:Security Best Practices on AWS
- 程序設計缺陷分析與實踐
- 西門子S7-200 SMART PLC從入門到精通
- CSS全程指南
- Machine Learning with Apache Spark Quick Start Guide
- Docker on Amazon Web Services
- 氣動系統裝調與PLC控制
- 電腦日常使用與維護322問
- 單片機原理實用教程
- Mastering Geospatial Analysis with Python
- 基于敏捷開發的數據結構研究
- 強化學習
- ASP.NET 2.0 Web開發入門指南
- 基于Proteus的單片機應用技術