PowerShell can be installed on Linux

This commit is contained in:
James Tombleson 2019-04-06 11:28:01 -07:00
parent 92e1b2cca3
commit bd95a6df37
6 changed files with 103 additions and 1 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
*.retry

View File

@ -1 +1,33 @@
# Ansible
# Ansible
First things first, install ansible
```bash
sudo apt-get install ansible
```
## Configuration
[doc](https://docs.ansible.com/ansible/latest/reference_appendices/config.html#ansible-configuration-settings-locations)
The configuration file
Changes can be made and used in a configuration file which will be searched for in the following order:
ANSIBLE_CONFIG (environment variable if set)
ansible.cfg (in the current directory)
~/.ansible.cfg (in the home directory)
/etc/ansible/ansible.cfg
## Inventory
The default location for inventory should be placed in /etc/ansible/hosts. But you can always overwrite what inventory file is used with the -i flag
## Cheat Sheet
Quick notes for ansible via cmd
```bash
ansible -i \inb
```

5
hosts Normal file
View File

@ -0,0 +1,5 @@
[linux]
192.168.0.60 ansible_connection=ssh ansible_user=miharu
[windows]
192.168.0.2 ansible_connection=winrm ansible_user=ansible

View File

@ -0,0 +1,6 @@
- name: Install Docker
hosts: linux
tasks:

View File

@ -0,0 +1,36 @@
- name: Install PowerShell Core
hosts: linux
#debugger: always
tasks:
- name: Check if PowerShell is installed
#register: command_result
failed_when: "'Failed' PowerShell is already installed."
apt:
name: powershell
state: absent
- name: Install Microsoft GPG Key
get_url:
url: https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb
dest: /tmp/
- name: Register GPG Key
become: true
become_method: sudo
apt: deb="/tmp/packages-microsoft-prod.deb"
#command: dpkg -i ~/packages-microsoft-prod.deb
- name: Update repos and Install PowerShell Core
become: true
become_method: sudo
apt:
name: powershell
update_cache: yes
state: present
- name: Remove Extra files
file:
state: absent
path: /tmp/packages-microsoft-prod.deb

View File

@ -0,0 +1,22 @@
- name: Update Repos
hosts: linux
tasks:
- name: Update Repos
become: true
become_method: sudo
apt:
update_cache: yes
- name: Upgrade Packages
become: true
become_method: sudo
apt:
upgrade: yes
- name: Remove unused packages
become: true
become_method: sudo
apt:
autoremove: yes