Skip to content

Instantly share code, notes, and snippets.

@minimum2scp
Last active December 12, 2018 09:10
Show Gist options
  • Save minimum2scp/ef8d2151be8abb89e9c6e1fe91309917 to your computer and use it in GitHub Desktop.
Save minimum2scp/ef8d2151be8abb89e9c6e1fe91309917 to your computer and use it in GitHub Desktop.
ansible apt_repository module replaces symlink to normal file
- hosts: localhost
become: yes
tasks:
- apt:
name: local-apt-repository
- stat:
path: /etc/apt/sources.list.d/local-apt-repository.list
register: stat_result
- assert:
that:
- stat_result.stat.islnk is defined and stat_result.stat.islnk
- stat_result.stat.lnk_source == "/usr/lib/local-apt-repository/local-apt-repository.list"
success_msg: /etc/apt/sources.list.d/local-apt-repository.list is symlink
fail_msg: /etc/apt/sources.list.d/local-apt-repository.list is NOT symlink
- apt_key:
url: https://dl.google.com/linux/linux_signing_key.pub
state: present
- apt_repository:
repo: deb http://dl.google.com/linux/chrome/deb/ stable main
state: present
filename: google-chrome
- stat:
path: /etc/apt/sources.list.d/local-apt-repository.list
register: stat_result2
- assert:
that:
- stat_result2.stat.islnk is defined and stat_result2.stat.islnk
- stat_result2.stat.lnk_source == "/usr/lib/local-apt-repository/local-apt-repository.list"
success_msg: /etc/apt/sources.list.d/local-apt-repository.list is symlink
fail_msg: /etc/apt/sources.list.d/local-apt-repository.list is NOT symlink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment