1268f4778d
* Introduce new 'filetree' lookup plugin
The new "filetree" lookup plugin makes it possible to recurse over a tree of files within the task loop. This makes it possible to e.g. template a complete tree of files to a target system with little effort while retaining permissions and ownership.
The module supports directories, files and symlinks.
The item dictionary consists of:
- src
- root
- path
- mode
- state
- owner
- group
- seuser
- serole
- setype
- selevel
- uid
- gid
- size
- mtime
- ctime
EXAMPLES:
Here is an example of how we use with_filetree within a role:
```yaml
- name: Create directories
file:
path: /web/{{ item.path }}
state: directory
mode: '{{ item.mode }}'
owner: '{{ item.owner }}'
group: '{{ item.group }}'
force: yes
with_filetree: web/
when: item.state == 'directory'
- name: Template complete tree
file:
src: '{{ item.src }}'
dest: /web/{{ item.path }}
state: 'link'
mode: '{{ item.mode }}'
owner: '{{ item.owner }}'
group: '{{ item.group }}'
with_filetree: web/
when: item.state == 'link'
- name: Template complete tree
template:
src: '{{ item.src }}'
dest: /web/{{ item.path }}
mode: '{{ item.mode }}'
owner: '{{ item.owner }}'
group: '{{ item.group }}'
force: yes
with_filetree: web/
when: item.state == 'file'
```
SPECIAL USE:
The following properties also have its special use:
- root: Makes it possible to filter by original location
- path: Is the relative path to root
- uid, gid: Makes it possible to force-create by exact id, rather than by name
- size, mtime, ctime: Makes it possible to filter out files by size, mtime or ctime
TODO:
- Add snippets to documentation
* Small fixes for Python 3
* Return the portion of the file’s mode that can be set by os.chmod()
And remove the exists=True, which is redundant.
* Use lstat() instead of stat() since we support symlinks
* Avoid a few possible stat() calls
* Bring in line with v1.9 and hybrid plugin
* Remove glob module since we no longer use it
* Included suggestions from @RussellLuo
- Two blank lines will be better. See PEP 8
- I think if props is not None is more conventional 😄
* Support failed pwd/grp lookups
* Implement first-found functionality in the path-order
|
8 years ago | |
---|---|---|
.github | 8 years ago | |
bin | 9 years ago | |
contrib | 8 years ago | |
docs/man | 8 years ago | |
docs-api | 8 years ago | |
docsite | 8 years ago | |
examples | 8 years ago | |
hacking | 8 years ago | |
lib/ansible | 8 years ago | |
packaging | 8 years ago | |
test | 8 years ago | |
ticket_stubs | 8 years ago | |
.coveragerc | 10 years ago | |
.gitattributes | 10 years ago | |
.gitignore | 8 years ago | |
.gitmodules | 9 years ago | |
.mailmap | 9 years ago | |
.travis.yml | 9 years ago | |
.yamllint | 9 years ago | |
CHANGELOG.md | 8 years ago | |
CODING_GUIDELINES.md | 11 years ago | |
CONTRIBUTING.md | 9 years ago | |
COPYING | 13 years ago | |
MANIFEST.in | 9 years ago | |
Makefile | 8 years ago | |
README.md | 9 years ago | |
RELEASES.txt | 9 years ago | |
ROADMAP.rst | 9 years ago | |
VERSION | 9 years ago | |
ansible-core-sitemap.xml | 9 years ago | |
setup.py | 9 years ago | |
shippable.yml | 8 years ago | |
tox.ini | 9 years ago |
README.md
Ansible
Ansible is a radically simple IT automation system. It handles configuration-management, application deployment, cloud provisioning, ad-hoc task-execution, and multinode orchestration - including trivializing things like zero downtime rolling updates with load balancers.
Read the documentation and more at http://ansible.com/
Many users run straight from the development branch (it's generally fine to do so), but you might also wish to consume a release.
You can find instructions here for a variety of platforms. If you decide to go with the development branch, be sure to run git submodule update --init --recursive
after doing a checkout.
If you want to download a tarball of a release, go to releases.ansible.com, though most users use yum
(using the EPEL instructions linked above), apt
(using the PPA instructions linked above), or pip install ansible
.
Design Principles
- Have a dead simple setup process and a minimal learning curve
- Manage machines very quickly and in parallel
- Avoid custom-agents and additional open ports, be agentless by leveraging the existing SSH daemon
- Describe infrastructure in a language that is both machine and human friendly
- Focus on security and easy auditability/review/rewriting of content
- Manage new remote machines instantly, without bootstrapping any software
- Allow module development in any dynamic language, not just Python
- Be usable as non-root
- Be the easiest IT automation system to use, ever.
Get Involved
- Read Community Information for all kinds of ways to contribute to and interact with the project, including mailing list information and how to submit bug reports and code to Ansible.
- All code submissions are done through pull requests. Take care to make sure no merge commits are in the submission, and use
git rebase
vsgit merge
for this reason. If submitting a large code change (other than modules), it's probably a good idea to join ansible-devel and talk about what you would like to do or add first and to avoid duplicate efforts. This not only helps everyone know what's going on, it also helps save time and effort if we decide some changes are needed. - Users list: ansible-project
- Development list: ansible-devel
- Announcement list: ansible-announce - read only
- irc.freenode.net: #ansible
Branch Info
- Releases are named after Led Zeppelin songs. (Releases prior to 2.0 were named after Van Halen songs.)
- The devel branch corresponds to the release actively under development.
- As of 1.8, modules are kept in different repos, you'll want to follow core and extras
- Various release-X.Y branches exist for previous releases.
- We'd love to have your contributions, read Community Information for notes on how to get started.
Authors
Ansible was created by Michael DeHaan (michael.dehaan/gmail/com) and has contributions from over 1000 users (and growing). Thanks everyone!
Ansible is sponsored by Ansible, Inc