diff --git a/lib/ansible/modules/packaging/os/apt.py b/lib/ansible/modules/packaging/os/apt.py index 78645a2c61..d92ed1db9c 100644 --- a/lib/ansible/modules/packaging/os/apt.py +++ b/lib/ansible/modules/packaging/os/apt.py @@ -139,9 +139,9 @@ requirements: - aptitude (before 2.4) author: "Matthew Williams (@mgwilliams)" notes: - - Three of the upgrade modes (C(full), C(safe) and its alias C(yes)) - required C(aptitude) up to 2.3, since 2.4 C(apt-get) is used as a - fall-back. + - Three of the upgrade modes (C(full), C(safe) and its alias C(yes)) required C(aptitude) up to 2.3, since 2.4 C(apt-get) is used as a fall-back. + - apt starts newly installed services by default, this is what the underlying tooling does, + to avoid this you can set the ``RUNLEVEL`` environment variable to 1. ''' EXAMPLES = ''' @@ -150,10 +150,13 @@ EXAMPLES = ''' name: foo update_cache: yes +- name: Install apache service but avoid starting it immediately + apt: name=apache2 state=present + environment: + RUNLEVLEL: 1 + - name: Remove "foo" package - apt: - name: foo - state: absent + apt: name=foo state=absent - name: Install the package "foo" apt: @@ -222,6 +225,7 @@ EXAMPLES = ''' - name: Remove dependencies that are no longer required apt: autoremove: yes + ''' RETURN = '''