Commit de4b87aa authored by nanahira's avatar nanahira

unfinished

parent edeec0b3
Pipeline #26692 failed with stage
in 5 minutes and 18 seconds
- name: clean some Debian packages
- name: set packages to remove
set_fact:
apt_packages_remove: [wireguard-dkms,ufw,iptables-persistent,needrestart,docker,docker-engine,docker.io,docker-io,docker-ee,lxd,unattended-upgrades]
- name: remove wireguard when upgrade
set_fact:
apt_packages_remove: '{{ apt_packages_remove + [ "wireguard-tools", "wireguard" ] }}'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 20 and target_distribution != ansible_distribution_release
- name: remove old ctags
set_fact:
apt_packages_remove: '{{ apt_packages_remove + [ "exuberant-ctags" ] }}'
when: ansible_distribution == 'Debian' or ansible_distribution_major_version|int >= 20
- name: remove not proper installed wireguard-tools
set_fact:
apt_packages_remove: '{{ apt_packages_remove + [ "wireguard-tools", "wireguard" ] }}'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 20
- name: remove open-vm-tools
become: true
set_fact:
apt_packages_remove: '{{ apt_packages_remove + [ "open-vm-tools" ] }}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "VMware" and vm_agents_status == "absent"
- name: qemu-guest-agent
become: true
set_fact:
apt_packages_remove: '{{ apt_packages_remove + [ "qemu-guest-agent" ] }}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm" and vm_agents_status == "absent"
- name: apt remove
become: true
apt:
name: ufw,iptables-persistent,needrestart,docker,docker-engine,docker.io,docker-io,docker-ee,lxd,unattended-upgrades
name: '{{ apt_packages_remove }}'
state: absent
purge: true
autoclean: true
- name: remove not proper installed wireguard repo
become: true
file:
path: '/etc/apt/sources.list.d/wireguard_ubuntu_wireguard_{{ ansible_distribution_release|lower }}.list'
state: absent
autoremove: yes
purge: yes
environment:
NEEDRESTART_SUSPEND: '1'
when: ansible_os_family == 'Debian'
when: ansible_distribution == 'Ubuntu'
......@@ -3,63 +3,62 @@
apt:
update_cache: true
name: aptitude
- name: apt
become: true
apt:
# update_cache: true
name: curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,p7zip-rar,xclip,astyle,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,iperf3,nmap,mosh,subversion,nfs-common,zsh,haveged,iptables,ipset,iproute2,python3-setuptools,python3-dev,python3-pip,wireguard-tools,zstd,gnupg2,python3-distro
- name: disable rpcbind
become: true
systemd:
name: '{{ item }}'
state: stopped
enabled: false
ignore_errors: true
when: not nfs
with_items:
- rpcbind
- rpcbind.socket
- name: set packages to install
set_fact:
apt_packages: [curl,wget,git,vim,sudo,byobu,iftop,iotop,build-essential,p7zip-full,p7zip-rar,xclip,astyle,tcpdump,rsync,htop,locales,mtr,dnsutils,net-tools,traceroute,tar,unzip,iperf,iperf3,nmap,mosh,subversion,nfs-common,zsh,haveged,iptables,ipset,iproute2,python3-setuptools,python3-dev,python3-pip,wireguard-tools,zstd,gnupg2,python3-distro]
# extra packages to install
- name: ctags in old Ubuntu
become: true
apt:
name: exuberant-ctags
set_fact:
apt_packages: '{{ apt_packages + [ "exuberant-ctags" ] }}'
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 20
- name: remove old ctags
become: true
apt:
name: exuberant-ctags
state: absent
purge: true
autoremove: true
when: ansible_distribution == 'Debian' or ansible_distribution_major_version|int >= 20
- name: ctags in new Ubuntu and Debian
become: true
apt:
name: universal-ctags
set_fact:
apt_packages: '{{ apt_packages + [ "universal-ctags" ] }}'
when: ansible_distribution == 'Debian' or ansible_distribution_major_version|int >= 20
- name: python-is-python3
become: true
apt:
name: python-is-python3
set_fact:
apt_packages: '{{ apt_packages + [ "python-is-python3" ] }}'
when: (ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int >= 20) or (ansible_distribution == 'Debian' and ansible_distribution_major_version|int >= 11)
- name: pve kernel header
become: true
apt:
name: 'pve-headers-{{ansible_kernel}},ifupdown2'
set_fact:
apt_packages: '{{ apt_packages + [ "pve-headers-" + ansible_kernel, "ifupdown2" ] }}'
when: ansible_kernel.endswith("-pve")
- name: add docker
set_fact:
apt_packages: '{{ apt_packages + [ "docker-ce", "docker-compose-plugin" ] }}'
when: install_docker
- name: open-vm-tools
become: true
apt:
name: open-vm-tools
state: '{{vm_agents_status}}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "VMware"
set_fact:
apt_packages: '{{ apt_packages + [ "open-vm-tools" ] }}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "VMware" and vm_agents_status == "present"
- name: qemu-guest-agent
set_fact:
apt_packages: '{{ apt_packages + [ "qemu-guest-agent" ] }}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm" and vm_agents_status == "present"
- name: apt
become: true
apt:
name: qemu-guest-agent
state: '{{vm_agents_status}}'
when: ansible_virtualization_role == "guest" and ansible_virtualization_type == "kvm"
# update_cache: true
name: '{{ apt_packages }}'
- name: apt autoremove
become: true
apt:
autoremove: true
purge: true
- name: set services to disable
set_fact:
services_to_disable:
- iperf3
- name: non nfs should disable rpcbind
set_fact:
# append to the list
services_to_disable: ' {{ services_to_disable + [ "rpcbind", "rpcbind.socket" ] }}'
- name: disable services
become: true
systemd:
name: '{{ item }}'
state: stopped
enabled: false
ignore_errors: true
when: not nfs
with_items: '{{services_to_disable}}'
......@@ -4,10 +4,10 @@
name: /usr/share/byobu/status/status
line: 'tmux_right="#network #disk_io #custom #entropy raid reboot_required updates_available #apport #services #mail #users uptime #ec2_cost #rcs_cost #fan_speed #cpu_temp #battery #wifi_quality #processes load_average cpu_count cpu_freq memory #swap disk #whoami hostname #ip_address #time_utc #date #time"'
regexp: ^tmux_right=
- name: 终端环境 byobu enable
shell: echo 'exit 0' | byobu-enable
changed_when: false
failed_when: false
#- name: 终端环境 byobu enable
# shell: echo 'exit 0' | byobu-enable
# changed_when: false
# failed_when: false
- name: 终端环境 byobu ctrl-a
command: byobu-ctrl-a emacs
args:
......
- name: remove not proper installed wireguard-tools
become: true
apt:
name: wireguard-tools,wireguard
state: absent
autoremove: yes
purge: yes
when: ansible_distribution == 'Ubuntu' and ansible_distribution_major_version|int < 20
- name: remove not proper installed wireguard
become: true
apt:
name: wireguard-dkms
state: absent
autoremove: yes
purge: yes
- name: remove not proper installed wireguard repo
become: true
file:
path: '/etc/apt/sources.list.d/wireguard_ubuntu_wireguard_{{ ansible_distribution_release|lower }}.list'
state: absent
when: ansible_distribution == 'Ubuntu'
- name: 安装 Docker (apt)
become: true
apt:
name: docker-ce,docker-compose-plugin
state: latest
update_cache: yes
when: ansible_os_family == 'Debian'
notify: restart_docker
- name: clean yum Docker
become: true
yum:
......
......@@ -57,28 +57,30 @@
path: '/usr/local/lib/python{{item}}/dist-packages/easy-install.pth'
state: absent
with_items:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- name: clean external managed flag
become: true
file:
path: /usr/lib/python{{item}}/EXTERNALLY-MANAGED
state: absent
with_items:
- 2.7
- 3.5
- 3.6
- 3.7
- 3.8
- 3.9
- 3.10
- 3.11
- '2.7'
- '3.5'
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
- name: upgrade pip
become: true
pip:
......
- name: debian-pre-upgrade
include_tasks: 'debian-pre-upgrade.yml'
when: ansible_os_family == 'Debian' and target_distribution != ansible_distribution_release
- name: byobu disable when upgrading to Ubuntu 24.04
shell: byobu-disable
ignore_errors: true
changed_when: false
when: target_distribution != ansible_distribution_release and target_distribution == 'noble'
- name: apt upgrade
become: true
apt:
......
......@@ -77,9 +77,9 @@
set_fact:
target_distribution: '{{ ansible_distribution_release }}'
when: not upgrade or ansible_distribution_release == 'sid' or keep_distro
- name: move to jammy
- name: move to noble
set_fact:
target_distribution: 'jammy'
target_distribution: 'noble'
when: ansible_distribution == 'Ubuntu' and upgrade and not keep_distro
- name: move to bookworm
set_fact:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment